From 323083a130371a54b41030812f822287af390f8e Mon Sep 17 00:00:00 2001 From: Bogdan Kostyuk Date: Sun, 27 Oct 2024 12:32:14 +0200 Subject: [PATCH] chore: show different loading message when there is no cached note yet --- pages/@[user]/[...folders]/[note].vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pages/@[user]/[...folders]/[note].vue b/pages/@[user]/[...folders]/[note].vue index 6c817236..bcc01962 100644 --- a/pages/@[user]/[...folders]/[note].vue +++ b/pages/@[user]/[...folders]/[note].vue @@ -31,11 +31,6 @@ async function fetchNote(): Promise { lastRefetch = Date.now(); - loadingToast = createToast('This is cached note, wait for new one to arrive...', { - delay: parseDuration('3 seconds'), - type: 'loading', - }); - let hydrationPromise = getHydrationPromise(); $fetch(`/api/note${noteApiPath.value}`, { signal: abortControllerGet.signal }) @@ -78,6 +73,17 @@ async function fetchNote(): Promise { hydrationPromise = undefined; } + loadingToast = createToast( + cachedNote + ? 'This is cached note, wait for new one to arrive...' + : 'This shouldn\'t take a long time...', + { + delay: parseDuration('3 seconds'), + type: 'loading', + duration: Infinity, + }, + ); + note.value = cachedNote; }