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

DOM isn't rendered in onMounted() when using vue-router and <Suspense /> #1733

Closed
Minibrams opened this issue Mar 12, 2023 · 1 comment
Closed

Comments

@Minibrams
Copy link

Reproduction

https://stackblitz.com/edit/vite-ajtmyh?file=src/views/Home.vue

Steps to reproduce the bug

  1. While running the reproduction example, open DevTools in your browser
  2. Refresh the page to force a re-render
  3. Observe that the console contains three logs from Home.vue, SyncComponent.vue, and AsyncComponent.vue that logs their respective DOM elements.

Expected behavior

The console.log()s from Home.vue, SyncComponent.vue, and AsyncComponent.vue should contain non-null DOM elements.

Actual behavior

The console.log()s from Home.vue, SyncComponent.vue, and AsyncComponent.vue all show that their respective DOM elements are null at the time of logging.

Additional information

Since each of the console.log() calls are made inside onMounted(), I would expect the DOM nodes to be inserted and rendered as per the official documentation on Lifecycle Hooks.

Further, since the setup of vue-router and <Suspense> together follows the official documentation (see App.vue), I do not expect this lifecycle principle to break.

@posva
Copy link
Member

posva commented Mar 13, 2023

Duplicate of vuejs/core#5844

@posva posva marked this as a duplicate of vuejs/core#5844 Mar 13, 2023
@posva posva closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2023
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

No branches or pull requests

2 participants