-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: MemoryHistory
does not emit events using listen
#9351
Comments
It's because the default react-router/packages/router/history.ts Line 208 in cb7f510
That is failing this check before calling the listener: react-router/packages/router/history.ts Lines 267 to 269 in cb7f510
@brophdawg11 Do you know why we don't run listeners by default in @remix-run/router? |
Yep! In
With the introduction of the data APIs and
POP is the exception here, since we can't intercept a back button click prior to history being updated, so we're still in a listener mode there.
|
Alright, for me it is currently enough that I can specify the Thank you for your explanation! |
Dropping a link here to this more extensive explanation regarding direct usage of |
What version of React Router are you using?
v6.4.0
Steps to Reproduce
Expected Behavior
I would expect that the callback I pass to the
listen
method gets called when I push a new route. Also when using theunstable_HistoryRouter
I would expect, that the router actually changes the content.Actual Behavior
The test fails because the callback does not get called. When I look into this repo I can spot these sections which might be wrong, or copied wrong.
Old
listen
inhistory
: https://github.com/remix-run/history/blob/3e9dab413f4eda8d6bce565388c5ddb7aeff9f7e/packages/history/index.ts#L993New
listen
in@remix/router
:react-router/packages/router/history.ts
Line 287 in cb7f510
I think this test is misleading here, no?
react-router/packages/router/__tests__/TestSequences/ListenPopOnly.ts
Line 12 in cb7f510
Actually, this is also why for me the
unstable_HistoryRouter
does not work. I am currently using it for some tests.The text was updated successfully, but these errors were encountered: