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
Currently the Navigator component can only show a NavigatorScreen component when the current location matches the screen's pathexactly.
Following up a request in #45884, in order to enable more advanced patterns we would like to allow the path prop in NavigatorScreen to accept patterns (i.e articles/:articleId), in order to enable pattern matching
Plan of action:
Re-architect how the component matches the current location to each NavigatorScreen. This allows Navigator to make sure that only screen in matched in case of potential multiple matches (not too differently from what happens inside the ToolsPanel component)
Add an internal instanceId for every NavigatorScreen (automatically generated via dedicated hook)
Make it so that every NavigatorScreen element registers itself to the parent NavigatorProvider (indicating its instanceId and its path)
With the full list of screens available, NavigationProvider can perform the matching logic (initially, strict equality), and set the instanceId of the matching screen via context
Each NavigatorScreen can compare the matching instanceId to their own, and render its contents only if they are matching.
Once this re-architecture is in place, we can implement the patter-matching bit:
Research how other routing libraries are spec'ing pattern matching syntax
Implement pattern matching syntax
We should also pass an additional matches object (or similar), where each match is associated to its value (ie. {articleId: 'test-article-id'})
The text was updated successfully, but these errors were encountered:
Currently the
Navigator
component can only show aNavigatorScreen
component when the currentlocation
matches the screen'spath
exactly.Following up a request in #45884, in order to enable more advanced patterns we would like to allow the
path
prop inNavigatorScreen
to accept patterns (i.earticles/:articleId
), in order to enable pattern matchingPlan of action:
location
to eachNavigatorScreen
. This allowsNavigator
to make sure that only screen in matched in case of potential multiple matches (not too differently from what happens inside theToolsPanel
component)instanceId
for everyNavigatorScreen
(automatically generated via dedicated hook)NavigatorScreen
element registers itself to the parentNavigatorProvider
(indicating itsinstanceId
and itspath
)NavigationProvider
can perform the matching logic (initially, strict equality), and set theinstanceId
of the matching screen via contextNavigatorScreen
can compare the matchinginstanceId
to their own, and render its contents only if they are matching.matches
object (or similar), where each match is associated to its value (ie.{articleId: 'test-article-id'}
)The text was updated successfully, but these errors were encountered: