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

Hydration completed but contains mismatches #1627

Closed
3 tasks done
laterdays opened this issue Nov 20, 2022 · 10 comments · Fixed by #1642
Closed
3 tasks done

Hydration completed but contains mismatches #1627

laterdays opened this issue Nov 20, 2022 · 10 comments · Fixed by #1642

Comments

@laterdays
Copy link

Describe the bug

It will report errors in production

app.b77605b4.js:1 Hydration completed but contains mismatches

Reproduction

Expected behavior

It will report errors in production

app.b77605b4.js:1 Hydration completed but contains mismatches

System Info

windows

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@laterdays laterdays added the bug: pending triage Maybe a bug, waiting for confirmation label Nov 20, 2022
@GOGOGOSIR
Copy link

I have the same problem, When I introduce elementplus in vitepress, it packs successfully, but after running docs:serve I get this problem. But I tried docs:dev, and it works fine

image

vitepress Configuration:
image

@godxiaoji
Copy link

I have the same problem, When I introduce elementplus in vitepress, it packs successfully, but after running docs:serve I get this problem. But I tried docs:dev, and it works fine

It is possible the components of ElementPlus do not support SSR properly. Expand the error cause to see the error source.

@laterdays
Copy link
Author

图片
@godxiaoji

@laterdays
Copy link
Author

You can only see this information, and you can't see the specific source

@laterdays
Copy link
Author

@brc-dd After the addition, the problem persists, i use vitepress-plugin-search & naive-ui

@greenhat616
Copy link

greenhat616 commented Nov 24, 2022

@brc-dd After the addition, the problem persists, i use vitepress-plugin-search & naive-ui

The Vitepress-plugin-search will result in this issue.
Related: emersonbottero/vitepress-plugin-search#23

@tolking
Copy link
Contributor

tolking commented Nov 25, 2022

may be related to the teleports

@brc-dd brc-dd removed the bug: pending triage Maybe a bug, waiting for confirmation label Nov 27, 2022
@brc-dd
Copy link
Member

brc-dd commented Nov 27, 2022

The issue might be related to vitepress-plugin-search as some people have mentioned. Not with vitepress itself. We can't tell unless you provide us a minimal reproducible example. If removing the plugin fixes it, then create an issue on it's repo instead.

I'll review #1642 too, but it is less likely to be used by that plugin, using ClientOnly or SafeTeleport might be better choices there.

@brc-dd brc-dd closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2022
@tolking
Copy link
Contributor

tolking commented Nov 28, 2022

The reason for the problem is that the Teleport needs special handling during SSR.

Reproduction

  • input
<Teleport to="body">
  <p>any content</p>
</Teleport>
  • docs-build
  • docs-serve
  • the error will occur when the relevant page is opened directly (or refresh the page)

Although the ClientOnly components can be used to wrap Teleport, but the relevant content will not be generated in the final page HTML. For SSG, should not it generate more static content?

The PR #1642 provides a way to inject the teleport markup into the correct location in final page HTML.

@haiting
Copy link

haiting commented Dec 30, 2022

@brc-dd After the addition, the problem persists, i use vitepress-plugin-search & naive-ui

Is the vitepress-plugin-search plugin working successfully after build:docs on your project ?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants