From fa6e01b46e0a8e47902db74e1c40893ef4609049 Mon Sep 17 00:00:00 2001 From: Reece Date: Wed, 8 Oct 2025 12:26:34 +0100 Subject: [PATCH] Clean up --- frontend/src/contexts/FileContext.tsx | 9 +-------- frontend/src/contexts/file/FileReducer.ts | 11 ----------- frontend/src/types/fileContext.ts | 4 +--- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/frontend/src/contexts/FileContext.tsx b/frontend/src/contexts/FileContext.tsx index a030fb45c..f67a1acee 100644 --- a/frontend/src/contexts/FileContext.tsx +++ b/frontend/src/contexts/FileContext.tsx @@ -124,11 +124,6 @@ function FileContextInner({ baseActions.unpinFile(file.fileId); }, [baseActions]); - // Refresh file context - triggers re-render of file-dependent components - const refreshFileContext = useCallback(() => { - dispatch({ type: 'REFRESH_CONTEXT' }); - }, []); - // Complete actions object const actions = useMemo(() => ({ ...baseActions, @@ -175,7 +170,6 @@ function FileContextInner({ } } }, - refreshFileContext, // Pinned files functionality with File object wrappers pinFile: pinFileWrapper, unpinFile: unpinFileWrapper, @@ -197,8 +191,7 @@ function FileContextInner({ pinFileWrapper, unpinFileWrapper, indexedDB, - enablePersistence, - refreshFileContext + enablePersistence ]); // Split context values to minimize re-renders diff --git a/frontend/src/contexts/file/FileReducer.ts b/frontend/src/contexts/file/FileReducer.ts index 97a2c753d..3811572c0 100644 --- a/frontend/src/contexts/file/FileReducer.ts +++ b/frontend/src/contexts/file/FileReducer.ts @@ -283,17 +283,6 @@ export function fileContextReducer(state: FileContextState, action: FileContextA return { ...initialFileContextState }; } - case 'REFRESH_CONTEXT': { - // Trigger re-render by returning new state object while preserving data - // This forces components to reload without losing file data - return { - ...state, - ui: { - ...state.ui - } - }; - } - default: return state; } diff --git a/frontend/src/types/fileContext.ts b/frontend/src/types/fileContext.ts index e4e61838f..7f62f945a 100644 --- a/frontend/src/types/fileContext.ts +++ b/frontend/src/types/fileContext.ts @@ -250,8 +250,7 @@ export type FileContextAction = | { type: 'SET_UNSAVED_CHANGES'; payload: { hasChanges: boolean } } // Context management - | { type: 'RESET_CONTEXT' } - | { type: 'REFRESH_CONTEXT' }; + | { type: 'RESET_CONTEXT' }; export interface FileContextActions { // File management - lightweight actions only @@ -286,7 +285,6 @@ export interface FileContextActions { // Context management resetContext: () => void; - refreshFileContext: () => void; // Resource management trackBlobUrl: (url: string) => void;