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

@@ -15,6 +15,8 @@ type Props = {
}
export class NoteGroupView extends PureComponent<Props, State> {
private removeChangeObserver!: () => void
constructor(props: Props) {
super(props, props.application)
this.state = {
@@ -25,18 +27,32 @@ export class NoteGroupView extends PureComponent<Props, State> {
override componentDidMount(): void {
super.componentDidMount()
this.application.noteControllerGroup.addActiveControllerChangeObserver(() => {
const controllerGroup = this.application.noteControllerGroup
this.removeChangeObserver = this.application.noteControllerGroup.addActiveControllerChangeObserver(() => {
const controllers = controllerGroup.noteControllers
this.setState({
controllers: this.application.noteControllerGroup.noteControllers,
controllers: controllers,
})
})
this.autorun(() => {
this.setState({
showMultipleSelectedNotes: this.appState.notes.selectedNotesCount > 1,
})
if (this.appState && this.appState.notes) {
this.setState({
showMultipleSelectedNotes: this.appState.notes.selectedNotesCount > 1,
})
}
})
}
override deinit() {
this.removeChangeObserver?.()
;(this.removeChangeObserver as unknown) = undefined
super.deinit()
}
override render() {
return (
<div id={ElementIds.EditorColumn} className="h-full app-column app-column-third">