Skip to content

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

Closed
@maoberlehner

Description

@maoberlehner

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions