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

fix(nuxt): sort routes with dynamic params at the end - #4983

Merged
pi0 merged 5 commits into
mainfrom
fix/sort-routes
Jun 9, 2022
Merged

fix(nuxt): sort routes with dynamic params at the end#4983
pi0 merged 5 commits into
mainfrom
fix/sort-routes

Conversation

@danielroe

@danielroedanielroe commented May 14, 2022

Copy link
Copy Markdown
Member

🔗 Linked issue

resolvesnuxt/nuxt#14117

❓ 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

Currently if there is a catchall [...slug].vueand and index.vue in a directory, the index will never be hit. (There are also some other variants of this issue.

We can resolve by sorting lists of routes to put dynamic parameters at the end of the list.

📝 Checklist

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

@danielroedanielroe added bug Something isn't working pages 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels May 14, 2022
@danielroe
danielroe requested a review from pi0May 14, 2022 13:37
@danielroedanielroe self-assigned this May 14, 2022
@netlify

netlifyBot commented May 14, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commit530c4cd
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62a1e174178c700008a0c638

@danielroedanielroe changed the title fix(nuxt): sort routes with slugs at the endfix(nuxt): sort routes with dynamic params at the endMay 14, 2022
@danielroe
danielroe marked this pull request as draft May 20, 2022 12:09
@danielroe

Copy link
Copy Markdown
MemberAuthor

I can't now reproduce this and wonder if it was originally reported as a side-effect of #5002.

@danielroe
danielroe deleted the fix/sort-routes branch May 20, 2022 13:04
@danielroe
danielroe restored the fix/sort-routes branch June 9, 2022 11:08
@danielroedanielroe reopened this Jun 9, 2022
@danielroe
danielroe marked this pull request as ready for review June 9, 2022 11:08
@pi0

pi0 commented Jun 9, 2022

Copy link
Copy Markdown
Member

Since we already discussed, isn't it something vue-router has to automatically resolve using route scores? Update: Just saw nuxt/nuxt#14117. An upstream issue would be nice to track :)

Comment threadpackages/nuxt/src/pages/utils.ts Outdated
Comment threadpackages/nuxt/src/pages/utils.ts Outdated
pi0
pi0 approved these changes Jun 9, 2022
@pi0

pi0 commented Jun 9, 2022

Copy link
Copy Markdown
Member

@danielroe Can you please check the failed test?

Comment threadpackages/nuxt/src/pages/utils.ts Outdated
@pi0
pi0 merged commit b31186b into mainJun 9, 2022
@pi0
pi0 deleted the fix/sort-routes branch June 9, 2022 12:09
@pi0pi0 mentioned this pull request Jun 10, 2022
danielroe added a commit that referenced this pull request Jun 10, 2022
pi0 pushed a commit that referenced this pull request Jun 10, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xbugSomething isn't working🔨 p3-minor-bugPriority 3: a bug in an edge case that only affects very specific usagepages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[...slug] pages has higher priority in sub directories

2 participants

@danielroe@pi0