Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue SSR hydration error (functional components) #7285

Open
vladeiko opened this issue Dec 7, 2022 · 4 comments · May be fixed by #7301
Open

Vue SSR hydration error (functional components) #7285

vladeiko opened this issue Dec 7, 2022 · 4 comments · May be fixed by #7301
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: ssr

Comments

@vladeiko
Copy link

vladeiko commented Dec 7, 2022

Vue version

3.2.25

Link to minimal reproduction

https://stackblitz.com/edit/github-zgzicn-7sfwqr?file=src%2FFunctionalComponent.tsx

Steps to reproduce

In SSR mode:

  • Create functional component
  • Return tag with text node and expression inside (e.g. <div>Text node {'expression'}</div>)

What is expected?

No errors/warnings

What is actually happening?

Hydration error

Logs:

[Vue warn]: Hydration text mismatch:
- Client: "Text node expression"
- Server: "Text node " 
  at <Anonymous> 
  at <App>
[Vue warn]: Hydration children mismatch in <div>: server rendered element contains fewer child nodes than client vdom. 
  at <Anonymous> 
  at <App>
Hydration completed but contains mismatches.

System Info

No response

Any additional comments?

No response

@zhangzhonghe
Copy link
Member

Minimal reproduction without tsx.

@zhangzhonghe zhangzhonghe added 🐞 bug Something isn't working scope: ssr labels Dec 7, 2022
@edison1105
Copy link
Member

edison1105 commented Dec 8, 2022

It works fine in tests.

test('Text', async () => {
expect(await render(createTextVNode('hello <div>'))).toBe(
`hello &lt;div&gt;`
)
})

case Text:
push(escapeHtml(children as string))
break

The code here is not executed, resulting in the TextVnode not being rendered on the server side in sfc playground. Similar to #6997. It seems that there are two instances of vue.

@yapengsoft
Copy link

@zhangzhonghe I love you

@Ives7
Copy link

Ives7 commented Aug 15, 2023

Anything new?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working scope: ssr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants