question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Node attribute value is not reactive after client side hydration

See original GitHub issue

Version

2.6.11

Reproduction link

https://codesandbox.io/s/ssr-reactivity-up6nh?file=/pages/index.vue

Steps to reproduce

  • The id attribute of the div does not match the myid value from the component (requires page refresh sometimes on first load).
  • Notice that $forceUpdate() (first button) does not update the id attribute of the div
  • Changing the value of the val data (second button) property triggers the reactivity

What is expected?

Every reference to the myid computed property should match

What is actually happening?

The id attribute of the div does not match the myid value


The same component used in client-side rendering does not exhibit this issue.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ValdoGhafoorcommented, Feb 16, 2022

Hi, I encountered the same issue Is there any other solution than having to use mounted ? We generate unique IDs for our components and use them also for some aria attributes

If we set those ID’s in mounted, we will loose SEO gain from accessibility attributes

Edit: putting a ref on the bugging node solve the issue

1reaction
berniegpcommented, May 18, 2020

@posva yeah it looks similar to #10260, but I’m not knowledgeable enough about Vue internals to be sure.

I did update my repro to use Vue.prototype.$isServer instead of Math.random() for greater clarity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understand and solve hydration errors in Vue.js - sum.cumo
Hydration refers to the client-side process during which Vue takes over ... Differences in attributes or text nodes do not lead to errors....
Read more >
dom-expressions/community - Gitter
The problem with hydration is instead of working on offscreen nodes we are working on live ones. So if the data isn't present...
Read more >
Why Efficient Hydration in JavaScript Frameworks is so ...
But it means no client side transitions and loss of client state on navigation. Effectively, Partial Hydration is an improved version of our ......
Read more >
Server-Side Rendering (SSR) - Vue.js
To make the client-side app interactive, Vue needs to perform the hydration step. During hydration, it creates the same Vue application that was...
Read more >
react-hydration-error - Next.js
In general this issue is caused by using a specific library or application code that is relying on something that could differ between...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found