-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
onServerPrefetch produces an invalid warning on ssr #6997
Comments
The playground doesn't seem to be working correctly; look at this, it has a warning about hydration: |
The example on the docs is missing the serialization of the data. Without it, the client is not aware of the initial state when it renders and thus creates a Hydration mismatch. I would say this should be fixed in docs instead |
It’s seems a bug, It’ve set the currentInstance before call the setup function. But the target output undefined when call the core/packages/runtime-core/src/component.ts Line 660 in f67bb50
core/packages/runtime-core/src/component.ts Line 564 in f67bb50
PS: It's work fine in the unit test case, but work failed in SSR mode playground and Nuxt. |
@webfansplz you are right, the problem happens with an empty call |
@posva I believe there is a bug in the online sfc-playground because it works fine in my local sfc-playground.
and there is a warning @zhangzhonghe mentioned VM682 about:srcdoc:160 [Vue warn]: Hydration text content mismatch in <h1>:
- Client: true
- Server: false
at <Repl>
@webfansplz that's the problem about the online sfc-playground. see #7011 (comment) |
Yes, I also found the sfc-playground's issue, which caused the But it doesn't seem to work very well in Nuxt3. Mini Repo |
Hello, I was having this question as well. After reading the docs on state management of Nuxt3. @webfansplz In your example Mini Repo, you can use // const data = ref(false)
const data = useState('data') |
Vue version
3
Link to minimal reproduction
https://sfc.vuejs.org/#__SSR__eNp9UktuwyAQvQpiUyIldtpl6kTqASpFapdsqDNOHNmABuyosrh7B3BSJZW6AObzeMzMY+Jv1hbjAHzDK1djaz1z4AfLOqWPW8m9k3wnNWNtbw16NkUboVnG0+h3M2gPh9n7ABwB95QGX58oGFiDpmdP9MDTa8TEVRvtPDsor9g2UolGdQ4WKf/IIZT71jUTC7bd5bev9y0Rtw6I4i4Zi/MDaqbhwvYZIwSCM90I90AWO/1sezCDFw8kM1O6JTwOsPjNhCV7Wa9vgZArJyMfeVcX1d6KFFdIbLoYVTfEuiNtiofEJXVVZgVo3uR46G2nPKTpV6fn3TTloYVQleRG/A3DlzwLtOqVLc7OaBI0dSPnBOm4ufYnOQkSfclP3lu3KUvX1PEbnF1h8FiSVSApS8MpwPWrLzQXB0jEkietZ46SgqTWCkEfAAH/43yA/uFNk6Avw8MPr+DWkQ==
Steps to reproduce
Setup()
, defineconst data = ref(false)
;onServerPrefetch
life Lifecycle, set thedata.value = true
;data
in the template is false;What is expected?
data.value
istrue
What is actually happening?
data.value
isfalse
System Info
No response
Any additional comments?
https://vuejs.org/api/composition-api-lifecycle.html#onserverprefetch
No response
The text was updated successfully, but these errors were encountered: