chore: app group optimizations (#1027)

This commit is contained in:
Mo
2022-05-16 21:14:18 -05:00
committed by GitHub
parent 754a189532
commit 62cf34e894
108 changed files with 1796 additions and 1187 deletions

View File

@@ -2,8 +2,7 @@ import { WebApplication } from '@/UIModels/Application'
import { Action, ActionVerb, HistoryEntry, NoteHistoryEntry, RevisionListEntry, SNNote } from '@standardnotes/snjs'
import { observer } from 'mobx-react-lite'
import { FunctionComponent } from 'preact'
import { StateUpdater, useCallback, useState } from 'preact/hooks'
import { useEffect } from 'react'
import { StateUpdater, useCallback, useState, useEffect } from 'preact/hooks'
import { LegacyHistoryList } from './LegacyHistoryList'
import { RemoteHistoryList } from './RemoteHistoryList'
import { SessionHistoryList } from './SessionHistoryList'
@@ -67,7 +66,7 @@ export const HistoryListContainer: FunctionComponent<Props> = observer(
}
fetchLegacyHistory().catch(console.error)
}, [application.actionsManager, note])
}, [application, note])
const TabButton: FunctionComponent<{
type: RevisionListTabType

View File

@@ -1,7 +1,7 @@
import { AppState } from '@/UIModels/AppState'
import { observer } from 'mobx-react-lite'
import { FunctionComponent } from 'preact'
import HistoryLockedIllustration from '../../../svg/il-history-locked.svg'
import { HistoryLockedIllustration } from '@standardnotes/icons'
import { Button } from '@/Components/Button/Button'
const getPlanHistoryDuration = (planName: string | undefined) => {

View File

@@ -64,7 +64,7 @@ export const RevisionHistoryModal: FunctionComponent<RevisionHistoryModalProps>
const note = Object.values(appState.notes.selectedNotes)[0]
const editorForCurrentNote = useMemo(() => {
return application.componentManager.editorForNote(note)
}, [application.componentManager, note])
}, [application, note])
const [isFetchingSelectedRevision, setIsFetchingSelectedRevision] = useState(false)
const [selectedRevision, setSelectedRevision] = useState<HistoryEntry | LegacyHistoryEntry>()
@@ -92,7 +92,7 @@ export const RevisionHistoryModal: FunctionComponent<RevisionHistoryModalProps>
setIsFetchingRemoteHistory(false)
}
}
}, [application.historyManager, note])
}, [application, note])
useEffect(() => {
if (!remoteHistory?.length) {

View File

@@ -29,7 +29,7 @@ export const SelectedRevisionContent: FunctionComponent<SelectedRevisionContentP
componentViewer.lockReadonly = true
componentViewer.overrideContextItem = templateNoteForRevision
return componentViewer
}, [application.componentManager, editorForCurrentNote, templateNoteForRevision])
}, [application, editorForCurrentNote, templateNoteForRevision])
useEffect(() => {
return () => {
@@ -37,7 +37,7 @@ export const SelectedRevisionContent: FunctionComponent<SelectedRevisionContentP
application.componentManager.destroyComponentViewer(componentViewer)
}
}
}, [application.componentManager, componentViewer])
}, [application, componentViewer])
return (
<div className="flex flex-col h-full overflow-hidden">