@@ -130,6 +130,12 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt
130
130
131
131
const limitCharsForNoteTitle = 50 ;
132
132
133
+ /**
134
+ * Is there any note currently saving
135
+ * Used to prevent re-load note after draft is saved
136
+ */
137
+ const isNoteSaving = ref < boolean > ( false ) ;
138
+
133
139
/**
134
140
* Note Title identifier
135
141
*/
@@ -213,6 +219,8 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt
213
219
*/
214
220
const specifiedNoteTools = resolveToolsByContent ( content ) ;
215
221
222
+ isNoteSaving . value = true ;
223
+
216
224
if ( currentId . value === null ) {
217
225
/**
218
226
* @todo try-catch domain errors
@@ -235,16 +243,16 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt
235
243
title : noteTitle . value ,
236
244
url : route . path ,
237
245
} ) ;
238
-
239
- return ;
246
+ } else {
247
+ await noteService . updateNoteContentAndTools ( currentId . value , content , specifiedNoteTools ) ;
240
248
}
241
249
242
- await noteService . updateNoteContentAndTools ( currentId . value , content , specifiedNoteTools ) ;
243
-
244
250
/**
245
251
* Store just saved content in memory
246
252
*/
247
253
lastUpdateContent . value = content ;
254
+
255
+ isNoteSaving . value = false ;
248
256
}
249
257
250
258
/**
@@ -300,11 +308,13 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt
300
308
return ;
301
309
}
302
310
311
+ const isDraftSaving = prevId === null && isNoteSaving . value ;
312
+
303
313
/**
304
314
* Case for newly created note,
305
315
* we don't need to re-load it
306
316
*/
307
- if ( prevId === null && newId !== null ) {
317
+ if ( isDraftSaving ) {
308
318
return ;
309
319
}
310
320
0 commit comments