From a7ad9b86f5104e1a42c67448c4ce27dbaee58ca9 Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Wed, 28 Aug 2024 21:31:57 +0300 Subject: [PATCH] B: Fix library cache update after changing OSS --- rsconcept/frontend/src/context/OssContext.tsx | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/rsconcept/frontend/src/context/OssContext.tsx b/rsconcept/frontend/src/context/OssContext.tsx index 74eb5812..f5a6c3b6 100644 --- a/rsconcept/frontend/src/context/OssContext.tsx +++ b/rsconcept/frontend/src/context/OssContext.tsx @@ -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(