From: Adam Dullage Date: Tue, 7 May 2024 11:41:05 +0000 (+0100) Subject: Fix issue loading new note X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=cca9dd86c8eeef63a288e6198964b4adcf81c971;p=flatnotes.git Fix issue loading new note --- diff --git a/client/views/Note.vue b/client/views/Note.vue index 3a6bb94..0ba885f 100644 --- a/client/views/Note.vue +++ b/client/views/Note.vue @@ -76,7 +76,7 @@ import { } from "@mdi/light-js"; import Mousetrap from "mousetrap"; import { useToast } from "primevue/usetoast"; -import { computed, ref, watch } from "vue"; +import { computed, onMounted, ref, watch } from "vue"; import { useRouter } from "vue-router"; import { createNote, deleteNote, getNote, updateNote } from "../api.js"; @@ -114,11 +114,11 @@ Mousetrap.bind("e", function () { function init() { // Return if we already have the note - if (props.title == note.value.title) { + if (props.title && props.title == note.value.title) { return; } - loadingIndicator.value?.setLoading(); // #CS + loadingIndicator.value.setLoading(); if (props.title) { getNote(props.title) .then((data) => { @@ -223,5 +223,6 @@ function noteSaveSuccess() { toast.add(getToastOptions("Success", "Note saved successfully.")); } -watch(() => props.title, init, { immediate: true }); +watch(() => props.title, init); +onMounted(init); diff --git a/client/views/SearchResults.vue b/client/views/SearchResults.vue index 93f95ee..68e948f 100644 --- a/client/views/SearchResults.vue +++ b/client/views/SearchResults.vue @@ -37,7 +37,7 @@