@bindu-dashing/dam-solution-v2 5.9.259 → 5.9.260

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.
@@ -20,7 +20,7 @@ import CustomButton from "../../common/Button";
20
20
  import { showNotification } from "../../common/notifications";
21
21
  import { FILE_UPLOAD_ERROR, SOMETHING_WENT_WRONG, UPDATE_SUCCESS, } from "../../utilities/constants/messages";
22
22
  import { CREATE_FILE_URL, FILE_UPLOAD_URL, SAVE_EDITED_FILE_THUMBNAIL_URL, SAVE_EDITED_FILE_URL, } from "../../utilities/constants/apiUrls";
23
- import { generateFoldersQueryKey, invalidateData, QueryKeys, } from "../../utilities/constants/queryKeys";
23
+ import { QueryKeys } from "../../utilities/constants/queryKeys";
24
24
  import { useQueryClient } from "react-query";
25
25
  import { useDamConfig } from "../../hocs/DamConfigContext";
26
26
  import { createApiClient } from "../../hocs/configureAxios";
@@ -39,8 +39,12 @@ const ImageEditorComponent = ({ file, handleClose, }) => {
39
39
  const { rootFolderId, brand } = damConfig;
40
40
  const brandId = get(brand, "_id");
41
41
  const api = useMemo(() => createApiClient(damConfig), [damConfig]);
42
- const { type, folderId } = useAppParams();
43
- const currentFolderId = folderId || rootFolderId;
42
+ const { folderId } = useAppParams();
43
+ // file.folderId is the folder the file actually lives in. Prefer it because
44
+ // `useAppParams().folderId` is undefined when the picker is opened as a
45
+ // modal (no URL change) — that was causing uploads to land in the root
46
+ // folder and invalidations to miss the picker's active query.
47
+ const currentFolderId = get(file, "folderId") || folderId || rootFolderId;
44
48
  const [state, setState] = useState({
45
49
  loading: false,
46
50
  confirmOpen: false,
@@ -48,12 +52,13 @@ const ImageEditorComponent = ({ file, handleClose, }) => {
48
52
  const { loading, confirmOpen } = state;
49
53
  const editorRef = useRef(null);
50
54
  const invalidateAfterChange = () => {
51
- invalidateData(queryClient, generateFoldersQueryKey(type), currentFolderId);
52
- invalidateData(queryClient, QueryKeys.FILE, get(file, "_id"));
53
- // Image picker uses ["image-pickers", id] as its own query key,
54
- // so the above invalidations don't refresh the picker grid. Hit it
55
- // by prefix so we don't need to know the specific picker id here.
55
+ // Prefix-only invalidation so we hit every relevant query regardless of
56
+ // its second key segment (folderId, picker id, mode, etc.). Going by
57
+ // exact key was missing the picker's active query because its folderId
58
+ // doesn't match useAppParams().folderId when the picker is a modal.
59
+ queryClient.invalidateQueries({ queryKey: [QueryKeys.FOLDERS] });
56
60
  queryClient.invalidateQueries({ queryKey: [QueryKeys.IMAGE_PICKERS] });
61
+ queryClient.invalidateQueries({ queryKey: [QueryKeys.FILE] });
57
62
  };
58
63
  const handleOverwrite = () => __awaiter(void 0, void 0, void 0, function* () {
59
64
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.9.259",
3
+ "version": "5.9.260",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",