@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 {
|
|
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 {
|
|
43
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
|
|
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;
|