framework icon indicating copy to clipboard operation
framework copied to clipboard

v-text on custom component with slot work in SPA but not in SSR

Open max5432112345 opened this issue 1 year ago • 5 comments

Environment

nuxt3 lates linux

Reproduction

https://github.com/max5432112345/nuxt-error-2/

Describe the bug

If use v-text on custom component with slot when in SPA text is displayed in page but in SSR not displayed (hot reload only sometime make it to display but after refresh page disappear).

Index.vue

<template>
  <div>
    <CustomText v-text="'test'" />
     <CustomText> TEST </CustomText>
  </div>
</template>

CustomText.vue


<template>
  <span>
    <slot name="default" />
  </span>
</template>

Additional context

No response

Logs

No response

max5432112345 avatar Aug 09 '22 17:08 max5432112345

In nuxt 2 it produced early warnings when used v-text without inner text (and I add $nbsp; to bypass that) but now no errors or warnings. Now in Nuxt 3 it not permit that to use inner text and v-text together.

In that situation it not show errors or warnings like nuxt 2:

Hydration children mismatch in

: server rendered element contains fewer child nodes than client vdom.

max5432112345 avatar Aug 09 '22 17:08 max5432112345

This sounds like an upstream Vue behaviour. Would you try to see if you can reproduce this on https://stackblitz.com/github/nuxt-contrib/vue3-ssr-starter/tree/main?terminal=dev ?

danielroe avatar Aug 09 '22 17:08 danielroe

This sounds like an upstream Vue behaviour. Would you try to see if you can reproduce this on https://stackblitz.com/github/nuxt-contrib/vue3-ssr-starter/tree/main?terminal=dev ?

@danielroe like that https://stackblitz.com/edit/github-lf1exv?terminal=dev? The same problem. One time worked well only (hot update may be).

max5432112345 avatar Aug 09 '22 18:08 max5432112345

Thanks for your good work diagnosing! ❤️

Good to know where it's coming from. Check issues at https://github.com/vuejs/core and feel free to raise one there if you think it is a bug.

We certainly want behaviour similar on SSR vs SPA.

danielroe avatar Aug 09 '22 18:08 danielroe

ok, thanks

max5432112345 avatar Aug 09 '22 18:08 max5432112345