Skip to content

Commit bebd44f

Browse files
committed
fix(runtime-core): ensure root stable fragments inherit elements for moving
fix #2134
1 parent c7b4a37 commit bebd44f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/runtime-core/src/renderer.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,12 @@ function baseCreateRenderer(
11571157
)
11581158
// #2080 if the stable fragment has a key, it's a <template v-for> that may
11591159
// get moved around. Make sure all root level vnodes inherit el.
1160-
if (n2.key != null) {
1160+
// #2134 or if it's a component root, it may also get moved around
1161+
// as the component is being moved.
1162+
if (
1163+
n2.key != null ||
1164+
(parentComponent && n2 === parentComponent.subTree)
1165+
) {
11611166
traverseStaticChildren(n1, n2, true /* shallow */)
11621167
}
11631168
} else {

0 commit comments

Comments
 (0)