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

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

Merged
merged 1 commit into from Oct 19, 2022
Merged

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

merged 1 commit into from Oct 19, 2022

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.

None yet

3 participants