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

fix(ssr): hydrate strings in fragments #5239

Closed
wants to merge 1 commit into from

Conversation

jaulz
Copy link
Contributor

@jaulz jaulz commented Jan 11, 2022

Right now, it seems that the hydrateChildren function optimizes too much. When you have a custom component that uses renderSlot and that renders a simple string it fails:
image

image

This PR removes the current check optimized = optimized || !!parentVNode.dynamicChildren so strings are converted to VNodes before they are compared in hydrateNode:
https://github.com/vuejs/vue-next/blob/92f11d6740929f5b591740e30ae5fba50940ec82/packages/runtime-core/src/hydration.ts#L379-L430

@yyx990803
Copy link
Member

Are you calling renderSlot manually? It's a compiler-only helper so the runtime will assume its return content is always normalized vnodes: https://template-explorer.vuejs.org/#eyJzcmMiOiI8Q29tcD5cblx0PHNsb3QgbmFtZT1cInRpdGxlXCI+ZmVzZjwvc2xvdD5cbjwvQ29tcD4iLCJvcHRpb25zIjp7ImhvaXN0U3RhdGljIjp0cnVlLCJjYWNoZUhhbmRsZXJzIjp0cnVlfX0=

You should not be using this in manual render function code.

@yyx990803 yyx990803 closed this Jan 21, 2022
@jaulz
Copy link
Contributor Author

jaulz commented Jan 21, 2022

@yyx990803 thanks for your feedback and explains a lot! 😊 Maybe it's worth a renaming (e.g. with a prefix) to indicate internal usage only?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants