feat(hmr): reload and force slot update on re-render
This commit is contained in:
@@ -111,10 +111,25 @@ export function renderComponentRoot(
|
||||
export function shouldUpdateComponent(
|
||||
prevVNode: VNode,
|
||||
nextVNode: VNode,
|
||||
parentComponent: ComponentInternalInstance | null,
|
||||
optimized?: boolean
|
||||
): boolean {
|
||||
const { props: prevProps, children: prevChildren } = prevVNode
|
||||
const { props: nextProps, children: nextChildren, patchFlag } = nextVNode
|
||||
|
||||
// Parent component's render function was hot-updated. Since this may have
|
||||
// caused the child component's slots content to have changed, we need to
|
||||
// force the child to update as well.
|
||||
if (
|
||||
__BUNDLER__ &&
|
||||
__DEV__ &&
|
||||
(prevChildren || nextChildren) &&
|
||||
parentComponent &&
|
||||
parentComponent.renderUpdated
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (patchFlag > 0) {
|
||||
if (patchFlag & PatchFlags.DYNAMIC_SLOTS) {
|
||||
// slot content that references values that might have changed,
|
||||
|
||||
Reference in New Issue
Block a user