From 2dedede5c37ee297952a102d36cae706b0547396 Mon Sep 17 00:00:00 2001 From: Kenichi Kobayashi Date: Wed, 8 Jun 2022 02:21:55 +0900 Subject: [PATCH] Removes unnecessary trivial dependencies that causes re-rendering (#6471) --- packages/app-desktop/gui/MainScreen/MainScreen.tsx | 2 -- .../gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx | 2 +- packages/app-desktop/gui/NoteEditor/NoteEditor.tsx | 1 - packages/app-desktop/gui/NoteEditor/utils/types.ts | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/app-desktop/gui/MainScreen/MainScreen.tsx b/packages/app-desktop/gui/MainScreen/MainScreen.tsx index 705c12377..693ff9b97 100644 --- a/packages/app-desktop/gui/MainScreen/MainScreen.tsx +++ b/packages/app-desktop/gui/MainScreen/MainScreen.tsx @@ -859,8 +859,6 @@ const mapStateToProps = (state: AppState) => { return { themeId: state.settings.theme, settingEditorCodeView: state.settings['editor.codeView'], - folders: state.folders, - notes: state.notes, hasDisabledSyncItems: state.hasDisabledSyncItems, hasDisabledEncryptionItems: state.hasDisabledEncryptionItems, showMissingMasterKeyMessage: showMissingMasterKeyMessage(syncInfo, state.notLoadedMasterKeys), diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx index 51cb92f41..7ece854be 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx @@ -259,7 +259,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) { return commandOutput; }, }; - }, [props.content, props.visiblePanes, addListItem, wrapSelectionWithStrings, setEditorPercentScroll, setViewerPercentScroll, resetScroll, renderedBody]); + }, [props.content, props.visiblePanes, addListItem, wrapSelectionWithStrings, setEditorPercentScroll, setViewerPercentScroll, resetScroll]); const onEditorPaste = useCallback(async (event: any = null) => { const resourceMds = await handlePasteEvent(event); diff --git a/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx b/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx index 01cc4d9ac..a1fe742c3 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx @@ -585,7 +585,6 @@ const mapStateToProps = (state: AppState) => { return { noteId: noteId, notes: state.notes, - folders: state.folders, selectedNoteIds: state.selectedNoteIds, selectedFolderId: state.selectedFolderId, isProvisional: state.provisionalNoteIds.includes(noteId), diff --git a/packages/app-desktop/gui/NoteEditor/utils/types.ts b/packages/app-desktop/gui/NoteEditor/utils/types.ts index f42fb33f4..edd587ad5 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/types.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/types.ts @@ -27,7 +27,6 @@ export interface NoteEditorProps { editorNoteStatuses: any; syncStarted: boolean; bodyEditor: string; - folders: any[]; notesParentType: string; selectedNoteTags: any[]; lastEditorScrollPercents: any;