@bindu-dashing/dam-solution-v2 5.8.20 → 5.8.21

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.
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { Button, Dropdown, Grid, Input, Select, Tooltip, Tree } from "antd";
12
- import { useEffect, useMemo, useState } from "react";
12
+ import { useEffect, useMemo, useState, useRef } from "react";
13
13
  import { get, map, isArray, isObject, cloneDeep, first, sortBy, } from "lodash";
14
14
  import { FaAngleLeft, FaAngleRight } from "react-icons/fa";
15
15
  import { deleteFolders, } from "../react-query/services/folder-services";
@@ -130,8 +130,17 @@ function FolderTree({ currentRootId, expandedKeys, selectedKeys, handleExpand, s
130
130
  }
131
131
  });
132
132
  // ✅ Load on mount & when currentRootId changes
133
+ // Use ref to track previous currentRootId to prevent unnecessary fetches
134
+ const prevCurrentRootIdRef = useRef(null);
133
135
  useEffect(() => {
134
- if (currentRootId) {
136
+ if (currentRootId && currentRootId !== prevCurrentRootIdRef.current) {
137
+ console.log('## FolderTree useEffect - currentRootId changed from', prevCurrentRootIdRef.current, 'to', currentRootId, 'rootFolderId:', rootFolderId);
138
+ prevCurrentRootIdRef.current = currentRootId;
139
+ fetchFolders(currentRootId);
140
+ }
141
+ else if (globalSearch !== globalSearchValue && currentRootId === rootFolderId) {
142
+ // Only refetch on global search change if we're on root folder
143
+ console.log('## FolderTree useEffect - globalSearch changed, refetching root folder');
135
144
  fetchFolders(currentRootId);
136
145
  }
137
146
  }, [currentRootId, globalSearch]);
@@ -17,8 +17,14 @@ export default function MyDriveMainContainer({ folders, setFolders }) {
17
17
  useEffect(() => {
18
18
  // Priority: URL params > Props from ParamsProvider > rootFolderId from config
19
19
  if (params === null || params === void 0 ? void 0 : params.folderId) {
20
+ console.log('## Setting selectedKeys from params.folderId:', params.folderId);
20
21
  setSelectedKeys(params.folderId);
21
22
  }
23
+ else if (!(params === null || params === void 0 ? void 0 : params.folderId) && rootFolderId) {
24
+ // If no params but we have rootFolderId, use it
25
+ console.log('## No params.folderId, using rootFolderId:', rootFolderId);
26
+ setSelectedKeys(rootFolderId);
27
+ }
22
28
  }, [params === null || params === void 0 ? void 0 : params.folderId, params === null || params === void 0 ? void 0 : params.id, params === null || params === void 0 ? void 0 : params.parentId, rootFolderId]);
23
29
  const currentRootId = isArray(selectedKeys)
24
30
  ? selectedKeys.length
@@ -27,6 +33,7 @@ export default function MyDriveMainContainer({ folders, setFolders }) {
27
33
  : selectedKeys
28
34
  ? selectedKeys
29
35
  : rootFolderId;
36
+ console.log('## MyDriveMainContainer - selectedKeys:', selectedKeys, 'currentRootId:', currentRootId, 'rootFolderId:', rootFolderId);
30
37
  const handleExpand = (keys) => {
31
38
  setExpandedKeys(map(keys, (k) => k.toString()));
32
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.8.20",
3
+ "version": "5.8.21",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",