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
When the router is present, the query param updates as expected.
However, when the router is removed, the query param value persists the latest value (although it does not update when the query param is changed again). I would expect the value to be undefined (or perhaps an error to be thrown) since there is no router present, but it appears that the useQueryParam reads the value from a global state?
I encountered this with some jest tests, where a component utilizing query parameters had two tests. One wrapped, one not wrapped. Modifying the query param within the component from the wrapped test would affect the value of the query param in the test where the component was not wrapped, behavior that I would not have expected.
E.g.
test 1:
<MemoryRouter><Component /></MemoryRouter>
perform some action that changes the query parameter
test 2:
<Component />
the query parameter value from the useQueryParam hook is persisted from the previous test
The text was updated successfully, but these errors were encountered:
Codesandbox: https://codesandbox.io/s/react-resource-router-basic-routing-example-forked-x621v9
When the router is present, the query param updates as expected.
However, when the router is removed, the query param value persists the latest value (although it does not update when the query param is changed again). I would expect the value to be undefined (or perhaps an error to be thrown) since there is no router present, but it appears that the useQueryParam reads the value from a global state?
I encountered this with some jest tests, where a component utilizing query parameters had two tests. One wrapped, one not wrapped. Modifying the query param within the component from the wrapped test would affect the value of the query param in the test where the component was not wrapped, behavior that I would not have expected.
E.g.
The text was updated successfully, but these errors were encountered: