From 9689b9d3b787b6314bb41edf8e6acd9ad455dc26 Mon Sep 17 00:00:00 2001 From: Gamebrary Date: Sun, 10 Jan 2021 11:01:49 -0700 Subject: [PATCH] Fix error when opening an empty note --- src/components/Game/GameNotesModal.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/Game/GameNotesModal.vue b/src/components/Game/GameNotesModal.vue index bb5829dd..17964792 100644 --- a/src/components/Game/GameNotesModal.vue +++ b/src/components/Game/GameNotesModal.vue @@ -95,10 +95,11 @@ export default { const { id } = this.game; - // TODO: use optional chaining - this.localNote = this.notes[id] && typeof this.notes[id] === 'object' && this.notes[id].text - ? this.notes[id].text - : JSON.parse(JSON.stringify(this.notes[id])); + if (this.notes[id]) { + this.localNote = typeof this.notes[id] === 'object' && this.notes[id].text + ? this.notes[id].text + : JSON.parse(JSON.stringify(this.notes[id])); + } }, async saveNote() {