@@ -73,7 +73,9 @@ import AttachmentList from './AttachmentList.vue'
7373import { NcActions , NcActionButton , NcModal } from ' @nextcloud/vue'
7474import { formatFileSize } from ' @nextcloud/files'
7575import { generateUrl } from ' @nextcloud/router'
76+ import { showWarning } from ' @nextcloud/dialogs'
7677import PaperclipIcon from ' vue-material-design-icons/Paperclip.vue'
78+ import { mapState } from ' vuex'
7779
7880const markdownIt = new MarkdownIt ({
7981 linkify: true ,
@@ -135,6 +137,9 @@ export default {
135137 }
136138 },
137139 computed: {
140+ ... mapState ({
141+ hasCardSaveError : (state ) => state .hasCardSaveError ,
142+ }),
138143 mimetypeForAttachment () {
139144 return (mimetype ) => {
140145 const url = OC .MimeType .getIconUrl (mimetype)
@@ -285,15 +290,31 @@ export default {
285290 return
286291 }
287292 this .descriptionSaving = true
288- if (this .card .id !== undefined ) {
289- await this .$store .dispatch (' updateCardDesc' , { ... this .card , description: this .description })
293+ try {
294+ if (this .card .id !== undefined ) {
295+ await this .$store .dispatch (' updateCardDesc' , { ... this .card , description: this .description })
296+ }
297+ this .$emit (' change' , this .description )
298+ this .descriptionLastEdit = 0
299+ this .$store .commit (' setHasCardSaveError' , false )
300+ } catch (e) {
301+ this .$store .commit (' setHasCardSaveError' , true )
302+ showWarning (t (' deck' , ' Could not save description' ), { timeout: 2500 })
303+ console .error (e)
304+
305+ // Retry of network error
306+ if ([' ERR_NETWORK' , ' ETIMEDOUT' ].includes (e .code )) {
307+ this .setSaveTimeout ()
308+ }
309+ } finally {
310+ this .descriptionSaving = false
290311 }
291- this .$emit (' change' , this .description )
292- this .descriptionLastEdit = 0
293- this .descriptionSaving = false
294312 },
295313 updateDescription () {
296314 this .descriptionLastEdit = Date .now ()
315+ this .setSaveTimeout ()
316+ },
317+ setSaveTimeout () {
297318 clearTimeout (this .descriptionSaveTimeout )
298319 this .descriptionSaveTimeout = setTimeout (async () => {
299320 await this .saveDescription ()
0 commit comments