Component view refactor (#770)

* refactor: simplify component-view lifecycle callbacks

* fix: reintroduce exhaustive-deps
This commit is contained in:
Mo
2021-12-13 11:16:14 -06:00
committed by GitHub
parent d5f75fee84
commit a15014f003
5 changed files with 201 additions and 216 deletions

View File

@@ -174,7 +174,8 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
this.editorValues.text = note.text;
}
const isTemplateNoteInsertedToBeInteractableWithEditor = source === PayloadSource.Constructor && note.dirty;
const isTemplateNoteInsertedToBeInteractableWithEditor =
source === PayloadSource.Constructor && note.dirty;
if (isTemplateNoteInsertedToBeInteractableWithEditor) {
return;
}
@@ -396,7 +397,7 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
this.reloadFont();
} else if (component.area === ComponentArea.Editor) {
const currentEditor = this.state.editorComponent;
if (currentEditor && component !== currentEditor) {
if (currentEditor && component.uuid !== currentEditor.uuid) {
await this.disassociateComponentWithCurrentNote(currentEditor);
}
const prefersPlain = this.note.prefersPlainEditor;