File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { useFilesSortingStore } from './filesSorting.js'
1818import { useFiltersStore } from './filters.js'
1919import { useIdentificationDocumentStore } from './identificationDocument.js'
2020import { useSidebarStore } from './sidebar.js'
21+ import { FILE_STATUS } from '../constants.js'
2122
2223/** @typedef {import('../types/index').IdentifyMethodRecord } SignerMethodRecord */
2324/** @typedef {import('../types/index').FileSettings } FileSettings */
@@ -248,6 +249,13 @@ const _filesStore = defineStore('files', () => {
248249 }
249250 : file
250251
252+ const shouldDiscardDraftForServerState = ( file ) => {
253+ const status = Number ( file ?. status )
254+ return status === FILE_STATUS . PARTIAL_SIGNED
255+ || status === FILE_STATUS . SIGNED
256+ || status === FILE_STATUS . SIGNING_IN_PROGRESS
257+ }
258+
251259 const syncPublicFile = ( fileId ) => {
252260 if ( ! fileId ) {
253261 return null
@@ -348,6 +356,9 @@ const _filesStore = defineStore('files', () => {
348356 }
349357
350358 const key = file . id ?? null
359+ if ( shouldDiscardDraftForServerState ( file ) ) {
360+ clearRequestDraft ( key )
361+ }
351362 const existingFile = apiFiles . value [ key ] || files . value [ key ]
352363 const resolvedDetailsLoaded = detailsLoaded
353364 ?? file . detailsLoaded
You can’t perform that action at this time.
0 commit comments