B: Fix library cache update after changing OSS

This commit is contained in:
Ivan 2024-08-28 21:31:57 +03:00
parent 800e492d89
commit a7ad9b86f5

View File

@ -134,12 +134,13 @@ export const OssState = ({ itemID, children }: OssStateProps) => {
onError: setProcessingError,
onSuccess: () => {
model.owner = newOwner;
library.localUpdateItem(model);
if (callback) callback();
library.reloadItems(() => {
if (callback) callback();
});
}
});
},
[itemID, model, library.localUpdateItem]
[itemID, model, library.reloadItems]
);
const setAccessPolicy = useCallback(
@ -157,12 +158,13 @@ export const OssState = ({ itemID, children }: OssStateProps) => {
onError: setProcessingError,
onSuccess: () => {
model.access_policy = newPolicy;
library.localUpdateItem(model);
if (callback) callback();
library.reloadItems(() => {
if (callback) callback();
});
}
});
},
[itemID, model, library.localUpdateItem]
[itemID, model, library.reloadItems]
);
const setLocation = useCallback(
@ -180,12 +182,13 @@ export const OssState = ({ itemID, children }: OssStateProps) => {
onError: setProcessingError,
onSuccess: () => {
model.location = newLocation;
library.localUpdateItem(model);
if (callback) callback();
library.reloadItems(() => {
if (callback) callback();
});
}
});
},
[itemID, model, library.localUpdateItem]
[itemID, model, library.reloadItems]
);
const setEditors = useCallback(
@ -203,11 +206,13 @@ export const OssState = ({ itemID, children }: OssStateProps) => {
onError: setProcessingError,
onSuccess: () => {
model.editors = newEditors;
if (callback) callback();
library.reloadItems(() => {
if (callback) callback();
});
}
});
},
[itemID, model]
[itemID, model, library.reloadItems]
);
const savePositions = useCallback(