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
I'm making the assumption here that this package supports multiple routers running at the same time as it does use context for isolation instead of some kind of global store. Described bug is not an issue if my assumption is wrong.
Router component provides context which isolates and enforces the scope of router functionality.
For example useLocation under <Router> returns the location for that particular router.
Link click handling (A component) breaks that principle and functionality because link click event handler is added to document and if you have multiple routers (with default integration or custom), only one integration setter will be always called.
I propose to handle it in some sort of scoped way, for example: <Router scopeEl={htmlElementRef} source={integration}> and
Go to Home (/) if not already there and open console
Click on any of the "Post X (modal)" links
Clear console log
Click on any of the "Post X (modal)" links in modal (links under router 2)
You can see in logs [router 1] set global loc: that even though this link is rendered under second <Router>, it will still invoke the setter for first <Router> integration.
Expected behavior
Link behaviour respects the context.
Link rendered under <Router1 source={integration1}> should invoke the integration1 setter.
Link rendered under <Router2 source={integration2}> should invoke the integration2 setter.
Screenshots or Videos
No response
Platform
OS: any
Browser: any
Version: 0.8.3
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
I'm making the assumption here that this package supports multiple routers running at the same time as it does use context for isolation instead of some kind of global store. Described bug is not an issue if my assumption is wrong.
Router component provides context which isolates and enforces the scope of router functionality.
For example
useLocation
under<Router>
returns the location for that particular router.Link click handling (
A
component) breaks that principle and functionality because link click event handler is added todocument
and if you have multiple routers (with default integration or custom), only one integration setter will be always called.I propose to handle it in some sort of scoped way, for example:
<Router scopeEl={htmlElementRef} source={integration}>
andOr a bit more advanced (and potentially buggy): automatically find the nearest parent HTML element for
<Router>
.Your Example Website or App
https://codesandbox.io/s/solid-app-router-example-forked-25ysls?file=/Index.js
Steps to Reproduce the Bug or Issue
/
) if not already there and open consoleYou can see in logs
[router 1] set global loc:
that even though this link is rendered under second<Router>
, it will still invoke the setter for first<Router>
integration.Expected behavior
Link behaviour respects the context.
Link rendered under
<Router1 source={integration1}>
should invoke theintegration1
setter.Link rendered under
<Router2 source={integration2}>
should invoke theintegration2
setter.Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: