B: Fix library cache update after changing OSS

This commit is contained in:
Ivan 2024-08-28 21:32:12 +03:00
parent cf3c9debc8
commit de0b240e78

View File

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