@bindu-dashing/dam-solution-v2 5.8.56 → 5.8.58
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/build/MyDrive/FolderTree.js +18 -3
- package/package.json +1 -1
|
@@ -206,11 +206,26 @@ function FolderTree({ currentRootId, expandedKeys, selectedKeys, handleExpand, s
|
|
|
206
206
|
if (!existingFolder || !isArray(existingFolder.children) || existingFolder.children.length === 0) {
|
|
207
207
|
fetchFolderChildren(currentRootId);
|
|
208
208
|
}
|
|
209
|
+
// Update ref to prevent re-triggering
|
|
210
|
+
prevCurrentRootIdRef.current = currentRootId;
|
|
209
211
|
}
|
|
210
212
|
else {
|
|
211
|
-
// Folder not in tree
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
// Folder not in tree - only replace tree if it's the root folder or folders is empty
|
|
214
|
+
// For subfolders clicked from list view, keep existing tree structure to avoid replacing it
|
|
215
|
+
if (currentRootId === rootFolderId || folders.length === 0) {
|
|
216
|
+
// Root folder or empty tree - fetch as new root
|
|
217
|
+
prevCurrentRootIdRef.current = currentRootId;
|
|
218
|
+
fetchFolders(currentRootId);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
// Subfolder not in tree but tree has content - keep existing tree structure
|
|
222
|
+
// The DriveContainer will handle showing the folder contents based on parentFolderId
|
|
223
|
+
// This prevents replacing the entire tree when clicking folders from list view
|
|
224
|
+
console.log('## Folder not in tree but tree has content - keeping existing tree structure');
|
|
225
|
+
prevCurrentRootIdRef.current = currentRootId;
|
|
226
|
+
// Don't call fetchFolders here to avoid replacing the tree
|
|
227
|
+
// The folder contents will be shown by DriveContainer based on parentFolderId
|
|
228
|
+
}
|
|
214
229
|
}
|
|
215
230
|
}
|
|
216
231
|
else if (globalSearch !== globalSearchValue && currentRootId === rootFolderId) {
|