Skip to content

Commit

Permalink
fix(router): ensure that the page has a higher priority (#5886)
Browse files Browse the repository at this point in the history
  • Loading branch information
yimingjfe committed Jun 26, 2024
1 parent a5a4fe0 commit 33e3a95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ export const walk = async (
if (pageAction) {
pageRoute.action = pageAction;
}
route.children?.push(pageRoute);

// Should ensure that the `page.tsx` has a higher priority than `__a/layout.tsx`
route.children?.unshift(pageRoute);
}

if (itemWithoutExt === NESTED_ROUTE.SPLATE_LOADER_FILE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ exports[`nested routes walk 1`] = `
{
"_component": "@_modern_js_src/user/layout",
"children": [
{
"_component": "@_modern_js_src/user/page",
"children": undefined,
"config": "@_modern_js_src/user/page.config",
"id": "user/page",
"index": true,
"loader": "@_modern_js_src/user/page.loader",
"type": "nested",
},
{
"_component": "@_modern_js_src/user/$",
"action": "@_modern_js_src/user/$.data",
Expand All @@ -58,15 +67,6 @@ exports[`nested routes walk 1`] = `
"path": ":id",
"type": "nested",
},
{
"_component": "@_modern_js_src/user/page",
"children": undefined,
"config": "@_modern_js_src/user/page.config",
"id": "user/page",
"index": true,
"loader": "@_modern_js_src/user/page.loader",
"type": "nested",
},
{
"_component": "@_modern_js_src/user/profile/layout",
"children": [
Expand Down

0 comments on commit 33e3a95

Please sign in to comment.