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

Components created with async component factory break on route change #9571

Closed
maoberlehner opened this issue Feb 25, 2019 · 2 comments
Closed
Labels

Comments

@maoberlehner
Copy link
Contributor

maoberlehner commented Feb 25, 2019

Version

2.6.7

Reproduction link

https://codesandbox.io/s/239l9qnkxn

Steps to reproduce

  1. Open https://codesandbox.io/s/239l9qnkxn
  2. Immediately (before the async component is resolved within 7 sec) click on the "Some Page" link
  3. Click on the "Home" link (before 7s are elapsed)

What is expected?

The AsyncReady component should render after 7 seconds.

What is actually happening?

The AsyncLoading component is shown forever


The problem is that the currentRenderingInstance is Home. After rendering the SomePage route, the initial Home instance (which is stored as the owner of the factory) is destroyed. As soon as the factory calls forceRender, triggering $forceUpdate() on the owner does nothing because the old Home instance already was destroyed and a new one was created when navigating back to Home.

This is problematic on very slow connections when users click a link before all dynamic components were resolved or in case of automatic redirects which are triggered immediately after a page is loaded (after checking auth for example).

See: https://github.com/vuejs/vue/blob/dev/src/core/vdom/helpers/resolve-async-component.js#L58-L74

@posva posva added the bug label Feb 25, 2019
@maoberlehner
Copy link
Contributor Author

The code in this Pull Request works in my case. But I'm not sure if this is ready for production 😅
#9572

@maoberlehner
Copy link
Contributor Author

Updated my Pull Request #9572 pretty happy with the code now.

maoberlehner added a commit to maoberlehner/vue that referenced this issue Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants