-
Notifications
You must be signed in to change notification settings - Fork 26k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add param names into the tree (#38415)
- Remove cache value that was incorrectly nested deeper - Remove extra useEffect (already applied during hydration based on the `useReducer` input) - Add dynamic parameter name into the tree Follow-up to #37551, cleans up some code and prepares for catch-all and optional catch-all routes.
- Loading branch information
1 parent
3411794
commit 0299f14
Showing
5 changed files
with
93 additions
and
54 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Segment } from '../../server/app-render' | ||
|
||
export const matchSegment = ( | ||
existingSegment: Segment, | ||
segment: Segment | ||
): boolean => { | ||
// Common case: segment is just a string | ||
if (typeof existingSegment === 'string' && typeof segment === 'string') { | ||
return existingSegment === segment | ||
} | ||
|
||
// Dynamic parameter case: segment is an array with param/value. Both param and value are compared. | ||
if (Array.isArray(existingSegment) && Array.isArray(segment)) { | ||
return ( | ||
existingSegment[0] === segment[0] && existingSegment[1] === segment[1] | ||
) | ||
} | ||
|
||
return false | ||
} |
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