-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
<Suspense>
+ <Transition>
means mounted() runs too early
#5844
Comments
any update? |
I also witnessed this issue in Nuxt 3. On hard load I can retrieve the DOM element via ref and acquire its size using getBoundingClientRect() but when navigating between routes (on the client), the onMounted() appears to run before the DOM is ready and present. Minimal reproduction: This is something to do with transitions. In my mind, this is a pretty serious bug as at the moment we're having to use |
It's causing a lot of issues and having to rely on a timeout, which is irregular, is too costly. |
There's a PR up that claims to fix this issue. However, it's been pretty stale for months now. Hope to see it merged soon. |
Confirm as comment: #5952 (comment) |
@yyx990803 Can you look on this ? Will unblock more people to upgrade Vue 3 and resolve plenty issue. PR exist and issue is mark as important. |
Linking #8967 |
Workaround for vuejs/core#5844
Just to give an update on this, I've created a PR #9388 aimed to fix this Vue.SFC.Playground.-.Personal.-.Microsoft.Edge.2023-10-12.20-59-54.mp4It's working, but since this is touching Suspense, I would expect more scrutiny while reviewing, because it can be very easy for this PR break things downstream. |
Suspense + Animation issue was fixed vuejs/core#5844
Version
3.2.33
Reproduction link
Steps to reproduce
Click the Toggle component button in the reproduction, and observe that a template ref is null rather than defined.
What is expected?
I expect the behaviour with suspense to be the same as the behaviour without suspense.
What is actually happening?
<Suspense>
means that the mounted() hook runs before the elements are present in the DOM.The text was updated successfully, but these errors were encountered: