primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.56k stars 1.23k forks source link

Hydration attribute mismatch on Icons #5187

Closed rizen closed 9 months ago

rizen commented 9 months ago

Describe the bug

While using PrimeVue 3.47.2 with Nuxt 3.10.0 (but this also happens with older versions as well) if you add the sortable attribute to a DataTable Column and then refresh the page to get a server side render of the page, you'll get a hydration mismatch. It appears to have something to do with the sort icon.

It might be that you should be generating IDs using Nuxt 3.10's new useId composable.

Here's the really ugly error message:

[Vue warn]: Hydration attribute mismatch on "

Reproducer

https://stackblitz.com/edit/primevue-nuxt-issue-template-r2uh4n?file=app.vue

PrimeVue version

3.47.2

Vue version

3.x

Language

ES6

Build / Runtime

Nuxt

Browser(s)

Safari 17

Steps to reproduce the behavior

  1. Add sortable to a DataTable Column.
  2. Refresh the page so you get a server side render.
  3. Look at your console.log

Expected behavior

No error should be generated in the console log. If you either remove sortable or wrap the DataTable in client-only then it works fine.

rizen commented 9 months ago

Note that this happens with other things that display icons also. For example if you:

<Message severity="error" :closable="false">
   message goes here
</Message>

Message causes the same problem when trying to display the icon related to the message severity when you get a server side render of this control. And again wrapping it in <client-only> will fix the error.

mertsincan commented 9 months ago

Hi,

This issue has already been fixed in the next version. Best Regards,