mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-12-18 20:04:17 +01:00
Clean up
This commit is contained in:
parent
23f85d7267
commit
fa6e01b46e
@ -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<FileContextActions>(() => ({
|
||||
...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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user