From ec92b438379f2944f3f9fd37721c4d320bffa524 Mon Sep 17 00:00:00 2001 From: Tushar Ahire Date: Mon, 24 Feb 2025 18:15:03 +0530 Subject: [PATCH 1/2] fix: rerenders the editor js component on prop change --- src/application/services/useNote.ts | 16 ++++++++-------- src/presentation/pages/Note.vue | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/application/services/useNote.ts b/src/application/services/useNote.ts index 39995625..a45543da 100644 --- a/src/application/services/useNote.ts +++ b/src/application/services/useNote.ts @@ -134,7 +134,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt * Is there any note currently saving * Used to prevent re-load note after draft is saved */ - const isNoteSaving = ref(false); + // const isNoteSaving = ref(false); /** * Note Title identifier @@ -219,7 +219,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt */ const specifiedNoteTools = resolveToolsByContent(content); - isNoteSaving.value = true; + // isNoteSaving.value = true; if (currentId.value === null) { /** @@ -252,7 +252,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt */ lastUpdateContent.value = content; - isNoteSaving.value = false; + // isNoteSaving.value = false; } /** @@ -297,7 +297,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt lastUpdateContent.value = null; } - watch(currentId, (newId, prevId) => { + watch(currentId, (newId, _prevId) => { /** * One note is open, user clicks on "+" to create another new note * Clear existing note @@ -308,15 +308,15 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt return; } - const isDraftSaving = prevId === null && isNoteSaving.value; + // const isDraftSaving = prevId === null && isNoteSaving.value; /** * Case for newly created note, * we don't need to re-load it */ - if (isDraftSaving) { - return; - } + // if (isDraftSaving) { + // return; + // } void load(newId); }); diff --git a/src/presentation/pages/Note.vue b/src/presentation/pages/Note.vue index d0cd75aa..23a7cacb 100644 --- a/src/presentation/pages/Note.vue +++ b/src/presentation/pages/Note.vue @@ -40,6 +40,7 @@ From 419419d27beb8fdbd0e522b39d138673488ac76b Mon Sep 17 00:00:00 2001 From: Tushar Ahire Date: Tue, 25 Feb 2025 21:31:11 +0530 Subject: [PATCH 2/2] fix: removes commented code blocks --- src/application/services/useNote.ts | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/application/services/useNote.ts b/src/application/services/useNote.ts index a45543da..e94cacca 100644 --- a/src/application/services/useNote.ts +++ b/src/application/services/useNote.ts @@ -130,12 +130,6 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt const route = useRoute(); - /** - * Is there any note currently saving - * Used to prevent re-load note after draft is saved - */ - // const isNoteSaving = ref(false); - /** * Note Title identifier */ @@ -219,8 +213,6 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt */ const specifiedNoteTools = resolveToolsByContent(content); - // isNoteSaving.value = true; - if (currentId.value === null) { /** * @todo try-catch domain errors @@ -251,8 +243,6 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt * Store just saved content in memory */ lastUpdateContent.value = content; - - // isNoteSaving.value = false; } /** @@ -308,16 +298,6 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt return; } - // const isDraftSaving = prevId === null && isNoteSaving.value; - - /** - * Case for newly created note, - * we don't need to re-load it - */ - // if (isDraftSaving) { - // return; - // } - void load(newId); });