You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
./src/pages
├── [...all].tsx
└── blog
└── [...all].tsx
└── [id].tsx
When enter /blog/1 it display blog/[id].tsx, it's correct. But, when I enter /blog, it looks not fallback to catch all route(blog/[...all].tsx). Currently, it display nothing.
Case 2
./src/pages
├── [...all].tsx
└── blog
└── [id].tsx
When I enter /blog, it looks not fallback to catch all route([...all].tsx). Currently, it display nothing.
Maybe it's related to resolved routes data, when routes data looks like this will meet above issue.
{
path: 'blog'
children: [{path: '*'}]}
The solution flat children routes(if parent route not found)
// if `blog.tsx` not exist{path: 'blog/*',element: blog/[...all].tsx}// if `blog.tsx` exist{path: 'blog',element: blog.tsxchildren: [{path: '*',element: [...all].tsx},{index: true,path: '',element: index.tsx}]}
Describe the bug
Case 1
I have a project, pages dir looks like this:
When enter
/blog/1
it displayblog/[id].tsx
, it's correct. But, when I enter/blog
, it looks not fallback to catch all route(blog/[...all].tsx
). Currently, it display nothing.Case 2
When I enter
/blog
, it looks not fallback to catch all route([...all].tsx
). Currently, it display nothing.Maybe it's related to resolved routes data, when routes data looks like this will meet above issue.
The solution flat children routes(if parent route not found)
Reproduction
https://github.com/JiangWeixian/vite-plugin-pages-minirepo
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: