From cb2fa0fff213e278f0106f4158e60d349e8b350e Mon Sep 17 00:00:00 2001 From: "Sode, Adedamola (DLSLtd,RAL,LSCI)" Date: Fri, 11 Sep 2026 14:57:51 +0100 Subject: [PATCH] Modified filecontext to provide update page functionality --- src/misc/fileContext.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/misc/fileContext.tsx b/src/misc/fileContext.tsx index 48a70b29..5db51b62 100644 --- a/src/misc/fileContext.tsx +++ b/src/misc/fileContext.tsx @@ -181,6 +181,11 @@ export type FileContextType = { pvwsHost?: string, replace?: boolean ) => void; + updatePage: ( + location: string, + fileDesc?: FileDescription, + replace?: boolean + ) => void; removePage: ( location: string, fileDesc?: FileDescription, @@ -207,6 +212,7 @@ const initialState: FileContextType = { pageState: {}, tabState: {}, addPage: () => {}, + updatePage: () => {}, removePage: () => {}, addTab: () => {}, removeTab: () => {}, @@ -269,6 +275,23 @@ export const FileProvider: React.FC = ( replace: replace ?? false }); }, + updatePage: ( + location: string, + fileDesc?: FileDescription, + replace = false + ): void => { + if (!fileDesc) return; + + const currentPageState = historyLocation.state?.pageState ?? pageState; + + navigate(historyLocation.pathname, { + state: { + pageState: { ...currentPageState, [location]: fileDesc }, + tabState: historyLocation.state?.tabState ?? tabState + }, + replace + }); + }, removePage: ( location: string, fileDesc?: FileDescription,