@lvce-editor/explorer-view 7.24.1 → 7.24.2

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.
@@ -4873,7 +4873,16 @@ const getNewDirentsForNewDirent = async (items, focusedIndex, type, root, exclud
4873
4873
  // Create new array with updated items
4874
4874
  const parentIndex = focusedIndex;
4875
4875
  const itemsBeforeParent = items.slice(0, parentIndex);
4876
- const itemsAfterChildren = items.slice(parentIndex + updatedChildren.length);
4876
+ const parentEndIndex = getParentEndIndex(items, parentIndex);
4877
+ const existingDescendants = items.slice(parentIndex + 1, parentEndIndex);
4878
+ let childIndex = 0;
4879
+ for (let i = 0; i < existingDescendants.length; i++) {
4880
+ if (existingDescendants[i].depth === depth) {
4881
+ existingDescendants[i] = updatedChildren[childIndex++];
4882
+ }
4883
+ }
4884
+ const newChildren = existingDescendants.length === 0 ? updatedChildren : [...existingDescendants, updatedChildren.at(-1)];
4885
+ const itemsAfterChildren = items.slice(parentEndIndex);
4877
4886
  let updatedParent = {
4878
4887
  ...items[parentIndex],
4879
4888
  setSize: (items[parentIndex]?.setSize || 0) + 1
@@ -4886,7 +4895,7 @@ const getNewDirentsForNewDirent = async (items, focusedIndex, type, root, exclud
4886
4895
  type: DirectoryExpanded
4887
4896
  };
4888
4897
  }
4889
- return [...itemsBeforeParent, updatedParent, ...updatedChildren, ...itemsAfterChildren];
4898
+ return [...itemsBeforeParent, updatedParent, ...newChildren, ...itemsAfterChildren];
4890
4899
  };
4891
4900
 
4892
4901
  const getNewDirentType = editingType => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "7.24.1",
3
+ "version": "7.24.2",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",