diff --git a/packages/app-desktop/app.ts b/packages/app-desktop/app.ts index 6f8d41559c0..d49ca86e105 100644 --- a/packages/app-desktop/app.ts +++ b/packages/app-desktop/app.ts @@ -513,10 +513,6 @@ class Application extends BaseApplication { }); } - this.store().dispatch({ - type: 'INITIAL_SELECTION_SET', - }); - this.store().dispatch({ type: 'FOLDER_SET_COLLAPSED_ALL', ids: Setting.value('collapsedFolderIds'), diff --git a/packages/app-mobile/root.tsx b/packages/app-mobile/root.tsx index 99a2fc53454..89152df1a81 100644 --- a/packages/app-mobile/root.tsx +++ b/packages/app-mobile/root.tsx @@ -725,10 +725,6 @@ async function initialize(dispatch: Function) { }); } - dispatch({ - type: 'INITIAL_SELECTION_SET', - }); - await clearSharedFilesCache(); } catch (error) { alert(`Initialization error: ${error.message}`); diff --git a/packages/lib/reducer.ts b/packages/lib/reducer.ts index fa95516395b..0e9823b0915 100644 --- a/packages/lib/reducer.ts +++ b/packages/lib/reducer.ts @@ -883,12 +883,6 @@ const reducer = produce((draft: Draft = defaultState, action: any) => { break; } - case 'INITIAL_SELECTION_SET': - // To allow creating notes when opening the app with all notes and/or tags, - // we also need a "last selected folder ID". - draft.selectedFolderId ??= draft.settings.activeFolderId; - break; - case 'SMART_FILTER_SELECT': draft.notesParentType = 'SmartFilter'; draft.selectedSmartFilterId = action.id; @@ -1341,6 +1335,12 @@ const reducer = produce((draft: Draft = defaultState, action: any) => { handleHistory(draft, action); } + if (action.type === 'SETTING_UPDATE_ALL' || (action.type === 'SETTING_UPDATE_ONE' && action.key === 'activeFolderId')) { + // To allow creating notes when opening the app with all notes and/or tags, + // a "last selected folder ID" needs to be set. + draft.selectedFolderId ??= draft.settings.activeFolderId; + } + for (const additionalReducer of additionalReducers) { additionalReducer.reducer(draft, action); }