@lvce-editor/virtual-dom 8.8.0 → 8.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1133,12 +1133,20 @@ const applyPatch = ($Element, patches, eventMap = {}, id = 0) => {
|
|
|
1133
1133
|
break;
|
|
1134
1134
|
case NavigateChild:
|
|
1135
1135
|
{
|
|
1136
|
-
const $
|
|
1136
|
+
const $Children = $Current.childNodes;
|
|
1137
|
+
const $Child = $Children[patch.index];
|
|
1137
1138
|
if (!$Child) {
|
|
1139
|
+
const nextPatch = patches[patchIndex + 1];
|
|
1140
|
+
if (nextPatch && nextPatch.type === Replace && patch.index === $Children.length) {
|
|
1141
|
+
const $Placeholder = document.createComment('virtual-dom-placeholder');
|
|
1142
|
+
$Current.append($Placeholder);
|
|
1143
|
+
$Current = $Placeholder;
|
|
1144
|
+
break;
|
|
1145
|
+
}
|
|
1138
1146
|
console.error('Cannot navigate to child: child not found at index', {
|
|
1139
1147
|
$Current,
|
|
1140
1148
|
index: patch.index,
|
|
1141
|
-
childCount: $
|
|
1149
|
+
childCount: $Children.length
|
|
1142
1150
|
});
|
|
1143
1151
|
return;
|
|
1144
1152
|
}
|