-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby): Wrong route resolved by findPageByPath function (#34070)
* use best matching route * add more comments * add tests * add matchPath specifity tests to findPageByPath * add note about possible optimalization for matchPath handling Co-authored-by: Michal Piechowiak <[email protected]>
- Loading branch information
Showing
6 changed files
with
199 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
e2e-tests/production-runtime/src/pages/ssr/path-ranking/[...].js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react" | ||
|
||
export default function StaticPath({ serverData }) { | ||
return ( | ||
<div> | ||
<h2>Query</h2> | ||
<pre data-testid="query">{JSON.stringify(serverData?.arg?.query)}</pre> | ||
<h2>Params</h2> | ||
<pre data-testid="params">{JSON.stringify(serverData?.arg?.params)}</pre> | ||
<h2>Debug</h2> | ||
<pre>{JSON.stringify({ serverData }, null, 2)}</pre> | ||
</div> | ||
) | ||
} | ||
|
||
export function getServerData(arg) { | ||
return { | ||
props: { | ||
arg, | ||
}, | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
e2e-tests/production-runtime/src/pages/ssr/path-ranking/[p1]/[p2].js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react" | ||
|
||
export default function StaticPath({ serverData }) { | ||
return ( | ||
<div> | ||
<h2>Query</h2> | ||
<pre data-testid="query">{JSON.stringify(serverData?.arg?.query)}</pre> | ||
<h2>Params</h2> | ||
<pre data-testid="params">{JSON.stringify(serverData?.arg?.params)}</pre> | ||
<h2>Debug</h2> | ||
<pre>{JSON.stringify({ serverData }, null, 2)}</pre> | ||
</div> | ||
) | ||
} | ||
|
||
export function getServerData(arg) { | ||
return { | ||
props: { | ||
arg, | ||
}, | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
e2e-tests/production-runtime/src/pages/ssr/path-ranking/[p1]/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react" | ||
|
||
export default function StaticPath({ serverData }) { | ||
return ( | ||
<div> | ||
<h2>Query</h2> | ||
<pre data-testid="query">{JSON.stringify(serverData?.arg?.query)}</pre> | ||
<h2>Params</h2> | ||
<pre data-testid="params">{JSON.stringify(serverData?.arg?.params)}</pre> | ||
<h2>Debug</h2> | ||
<pre>{JSON.stringify({ serverData }, null, 2)}</pre> | ||
</div> | ||
) | ||
} | ||
|
||
export function getServerData(arg) { | ||
return { | ||
props: { | ||
arg, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters