Replies: 10 comments 10 replies
-
Thanks @nikuscs . Could you share a minimal repro of this warning happening in SSR context? |
Beta Was this translation helpful? Give feedback.
-
There is no need a reproduction i believe, simply install the latest Vue beta , and import for example an accordion component, you will see stuff like : aria-controls="radix-26" will be 26 on the server but 81 lets say on the client. The actual DOM inside will be the same but recent Vue update also warns about the attributes diff. The useId() works ok but its not aware of the Server, so it will always warn about miss match. I trully believe Vue itself should be the one providing this hook but meanwhile i think we could probably use something like the Daniel Roe Package. |
Beta Was this translation helpful? Give feedback.
-
Agreed 👍 Idk why Vue team don't provide this composable/hook |
Beta Was this translation helpful? Give feedback.
-
Just a quick update here that the latest Nuxt version also bumps Vue, @zernonia do you wanna discuss this approach to implement anytime soon? it really bloats the browser console as it is. |
Beta Was this translation helpful? Give feedback.
-
After investigating and playing around a bit it seems no trivial issue to solve, probably lack of my deep understanding of the vue core, but i cant figure out how do we pass data from SSR generated into the actual client. Daniel package probably wont work since its bound with a directive, so we cannot "use" it outside of it, we can just bind it directly but not extract it, i have played around even with a Vite Plugin to see if we could get something fancy but couldnt get my way around it :\ I guess we have to push more forces into the Vue side to get this out of the door probably in Vue Core. Also Relevant: nuxt/nuxt#13406 and https://github.com/nuxt/nuxt/pull/23368/files#diff-56fa79b2b6b6d55801e7e885441f1ee98891adfbbe7d11844721dcfdc2dc5583 But Radix still needs to adapt, example : https://github.com/radix-vue/radix-vue/blob/b8eb9e37ea198e88f87535e5aa6f6a938f90aa2e/packages/radix-vue/src/Tabs/TabsRoot.vue#L72C11-L72C16 This is using a hard-coded useId() so even if we can generate unique Ids externally we cant hook into that provide :p |
Beta Was this translation helpful? Give feedback.
-
How about Radix implements something similar as a temporary fix? |
Beta Was this translation helpful? Give feedback.
-
Can we not switch to: https://nuxt.com/docs/api/composables/use-id |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Fixed with #577 (comment) 😁 |
Beta Was this translation helpful? Give feedback.
-
I have tried this way it works fine for me, I have make the accordionRoot a client component using `<script lang="ts" setup> interface AccordionFlushProps { const props = defineProps<AccordionRootProps & AccordionFlushProps>(); const emits = defineEmits(); const restProps = computed(() => { const forwardProps = useForwardPropsEmits(restProps, emits); useProvideAccordionStore(props.flush); const mounted = ref(false); onMounted(() => { |
Beta Was this translation helpful? Give feedback.
-
It seems like the latest Vue version also warns about attributes miss matches on SSR, this causes a lot of warnings on Radix Vue since the ids and auto-generated IDs are different on Server and Client ( actual miss match ), while some of them you could "force" by passing the attributes down, others are not that easy. ( And there is also no good way as far as i know to turn the warnings off )
Im wondering if it could be a nice solution to allow the users to:
Ideas / Discussions:
Beta Was this translation helpful? Give feedback.
All reactions