-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Support disposal for router #598
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
Comments
On a second thought, all I need is to be able to change |
I just merged 6417285 which is kinda related |
Yup, thanks! I'll rebase. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I propose
router
has adispose()
method that stop sending events torun
and cancels any pending transactions for good. Once a router is disposed, you can't use it anymore.One use-case for this is non-global routers (although personally I don't need this).
My use case is first-class support for hot reloading for routes. This is already possible with react-hot-loader and a bit of trickery in
index.js
:// some irrelevant code removed, see #606 instead
It is however slightly inconvenient to maintain
isDisposed
and effectively old routers keep hanging in memory potentially even reacting to location changes. Adding adispose
method to router would solve this.The text was updated successfully, but these errors were encountered: