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

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

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

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

Conversation

@johannschopplich

Copy link
Copy Markdown
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
Copy Markdown

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

@netlify

netlifyBot commented Oct 19, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commit90f9642
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/63500b5ac2676900089c3cc5

@johannschopplichjohannschopplich changed the title fix(app): router defaults overwrite custom options alwaysfix(nuxt): router defaults overwrite custom options alwaysOct 19, 2022
@pi0
pi0 merged commit 7b16719 into nuxt:mainOct 19, 2022
@pi0pi0 mentioned this pull request Nov 3, 2022
Sign up for freeto 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

@johannschopplich@danielroe@pi0