Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

fix(nuxt): router defaults overwrite custom options always#8334

Merged
pi0 merged 1 commit intonuxt:mainfrom
johannschopplich:fix/router-defaults-overwritten
Oct 19, 2022
Merged

fix(nuxt): router defaults overwrite custom options always#8334
pi0 merged 1 commit intonuxt:mainfrom
johannschopplich:fix/router-defaults-overwritten

Conversation

@johannschopplich
Copy link
Contributor

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Router default options were introduced in ba3a118. That's great! But now, custom implementations (via app/router.options.(js|ts) won't have an effect. The default options stay at the top of all router option layers.

The source of the error seems to be:

routerOptionsFiles.unshift(resolve(runtimeDir, 'router.options'))

unshift adds the default to the beginning, but the router options are reversed anyway later:

...routerOptionsFiles.map((_, index) => `...routerOptions${index},`).reverse(),

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox
Copy link

codesandbox bot commented Oct 19, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@netlify
Copy link

netlify bot commented Oct 19, 2022

Deploy Preview for nuxt3-docs canceled.

Name Link
🔨 Latest commit 90f9642
🔍 Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/63500b5ac2676900089c3cc5

@johannschopplich johannschopplich changed the title fix(app): router defaults overwrite custom options always fix(nuxt): router defaults overwrite custom options always Oct 19, 2022
@pi0 pi0 merged commit 7b16719 into nuxt:main Oct 19, 2022
@pi0 pi0 mentioned this pull request Nov 3, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants