Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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
@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
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants