Subscribe on changes!

nextTick not waiting for dom update

avatar
Oct 13th 2022

Vue version

3.2.40

Link to minimal reproduction

Steps to reproduce

click on any of the buttons, should render a spinner and components with a processor-heavy mount.

What is expected?

when using await nextTick() after clicking 2nd button, the spinner is not rendered before the other content and behaves same as the synchronous implementation.

What is actually happening?

I would expect it to behave the same way as the function that uses setTimeout

System Info

No response

Any additional comments?

based on the documentation:

nextTick() can be used immediately after a state change to wait for the DOM updates to complete. You can either pass a callback as an argument, or await the returned Promise

I would expect that this should work.

avatar
Oct 14th 2022

After await nextTick(), the DOM has actually been updated, except that the screen has not been rendered yet.

Open this and check the value of console.log.

avatar
Oct 14th 2022

not a bug

read about + workaround here https://github.com/vuejs/vue/issues/9200