-
-
Notifications
You must be signed in to change notification settings - Fork 5k
SSR memory leak in poll method #2606
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
After perusing the code-base of
I'd be happy implementing these or any other solution. It might be better to modify |
Hey @ronald-d-rogers sorry for the delay. Is vuejs/vue#9479 the solution you came up with at the end? or do we still need to change anything in Vue Router after that PR is merged? |
You would have to merge the PR in Vue, then one to check if the app is being destroyed here: vue-router/src/history/base.js Line 181 in fc42d9c
Let me go ahead and create a PR. |
Version
3.0.2
Reproduction link
https://jsfiddle.net/ronald_d_rogers/5mxdpkLj/2/
Steps to reproduce
Make
router-view
appearance conditional based on some variable (or simply have it not appear):Ensure that the component that matches the route has a
beforeRouteEnter
guard, where a function is passed to thenext(...)
method (e.g.next(vm => {}
):Visit that route.
A poll will happen infinitely until
router-view
is created.In a typical SSR application where an app is created per request, it will never be created.
The end result is a memory leak with an event loop filled with poll's every 16ms.
In the reproduction JS Fiddle, a leak occurs every time you press the
SSR Request
button.If you set
dontLeak
to true, the leak stops.The leak can be verified in the JS Fiddle by clicking on the
SSR Request
button a few times (say 20 times), opening Chrome Developer Tools, going to the Performance tab, and in the recording looking at the contents of "Frame".Here is an example repo as well:
https://github.com/ronald-d-rogers/vue-router-ssr-memory-leak
What is expected?
A new poll does not recurse infinitely for every SSR request.
What is actually happening?
A new poll recurses infinitely for every SSR request.
The text was updated successfully, but these errors were encountered: