From f4dd4deb7baeb41c15ab3498ce9a64ec40dd21c7 Mon Sep 17 00:00:00 2001 From: Reece Date: Tue, 28 Oct 2025 21:37:58 +0000 Subject: [PATCH] revert rile reducer --- .../src/core/contexts/file/FileReducer.ts | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/frontend/src/core/contexts/file/FileReducer.ts b/frontend/src/core/contexts/file/FileReducer.ts index 7cb46c05c..0f7c969da 100644 --- a/frontend/src/core/contexts/file/FileReducer.ts +++ b/frontend/src/core/contexts/file/FileReducer.ts @@ -75,43 +75,20 @@ export function fileContextReducer(state: FileContextState, action: FileContextA const { stirlingFileStubs } = action.payload; const newIds: FileId[] = []; const newById: Record = { ...state.files.byId }; - let hasInsertionPosition = false; stirlingFileStubs.forEach(record => { // Only add if not already present (dedupe by stable ID) if (!newById[record.id]) { newIds.push(record.id); - - // Track if any file has an insertion position - if (record.insertAfterPageId) { - hasInsertionPosition = true; - } - - // Store record WITH insertAfterPageId temporarily - // PageEditorContext will read it and clear it newById[record.id] = record; } }); - // Determine final file order - // NOTE: If files have insertAfterPageId, we just append to end - // The page-level insertion is handled by usePageDocument - const finalIds = [...state.files.ids, ...newIds]; - - // Auto-select inserted files - const newSelectedFileIds = hasInsertionPosition - ? [...state.ui.selectedFileIds, ...newIds] - : state.ui.selectedFileIds; - return { ...state, files: { - ids: finalIds, + ids: [...state.files.ids, ...newIds], byId: newById - }, - ui: { - ...state.ui, - selectedFileIds: newSelectedFileIds } }; }