-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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(runtime-core): properly diff slot node and fallback node #9213
Conversation
Size ReportBundles
Usages
|
c770a70
to
6169843
Compare
test: add test case chore: improve code chore: update test chore: update test
eab6e2c
to
ba26e1b
Compare
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering whether we should completely avoid slot content being paired against fallback content in the diff? I don't think users expect elements/components to be reused in this way and it seems bug prone.
Consider this example:
A similar example using a stateful child component:
const vnode = createVNode( | ||
'slot', | ||
props, | ||
fallback && fallback(), | ||
fallback ? PatchFlags.BAIL : undefined, | ||
) | ||
vnode.isSlotFallback = !!fallback | ||
return vnode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this part of the change. For custom elements, wouldn't switching between the slot content and the fallback be handled natively by the browser, rather than by the renderer? The presence of a fallback
doesn't necessarily mean that it is being shown in the component, we render it inside the native <slot>
either way and let the browser do the rest.
If this is needed then there should probably be a test for it. It seems that the current tests pass even without this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
close #9200
close #9308
close #7256
note:
Both slot fallback and slot nodes are stable fragments but can not take the fast path.
solution: