Skip to content
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

fix(router): prevent memory leaks by removing app references from $router.apps once app destroyed (Fixes #2639) #2640

Closed
wants to merge 14 commits into from

Conversation

tmorehouse
Copy link

@tmorehouse tmorehouse commented Mar 5, 2019

Prevent memory leaks by removing app(s) from $router.apps array once app has been destroyed.

Fixes #2639

…ixes vuejs#2639)


Prevent destroyed apps from causing memory leak in `$router.apps` array.

Fixes vuejs#2639
@tmorehouse tmorehouse changed the title fix(router): remove app from $router.apps array once app destroyed (Fixes #2639) fix(router): prevent memory leak by removing app reference from $router.apps once app destroyed (Fixes #2639) Mar 5, 2019
src/index.js Outdated Show resolved Hide resolved
@tmorehouse
Copy link
Author

@posva I have added test suites, and handled situation where the main (initial) app is destroyed.

@tmorehouse
Copy link
Author

Just wondering if there should be additional test(s) for a nested router (i.e. a second router created)?

@tmorehouse tmorehouse changed the title fix(router): prevent memory leak by removing app reference from $router.apps once app destroyed (Fixes #2639) fix(router): prevent memory leaks by removing app references from $router.apps once app destroyed (Fixes #2639) Mar 30, 2019
@posva
Copy link
Member

posva commented Mar 30, 2019

What do you mean by nested router?

@tmorehouse
Copy link
Author

tmorehouse commented Mar 30, 2019

@posva I see in the e2e tests there are tests for nested routers (a router within a router):

https://github.com/vuejs/vue-router/blob/dev/test/e2e/specs/nested-router.js

https://github.com/vuejs/vue-router/tree/dev/examples/nested-router

Although the multiple routers share the same Router class instance, so probably additional testing isn't necessary.

@posva
Copy link
Member

posva commented Apr 11, 2019

Closing in favor of #2706

@posva posva closed this Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants