Переглянути джерело

Fixed desynch persistence

luis 7 роки тому
батько
коміт
d09a8540f3

+ 3 - 1
browser/vue-flow/src/services/flowservice.js

@@ -86,8 +86,10 @@ function FlowService () {
       }
       if (ftyp !== 'documentUpdate') return // Do not persist other than documentUpdate on reconnection
       // Schedule when is connected
+      const lparam = JSON.parse(JSON.stringify(param))
       service.once('open', () => {
-        service.send({op: ftyp, id: id, data: param})
+        console.log('Sending the persistend: ', ftyp)
+        service.send({op: ftyp, id: id, data: lparam})
       })
     }
   })

+ 15 - 12
browser/vue-flow/src/store/ws.js

@@ -38,19 +38,22 @@ export default store => {
 
   // Connected
   flowService.connected(() => {
-    const match = /.*\/s:(.*)/.exec(store.state.route.path)
-    let sessId
-    if (match != null) {
-      sessId = match[1]
-    }
-    // Make this in a service
-    if (sessId === undefined) {
-      flowService.sessionNew()
-      return
-    }
-    store.commit(flow.SESSID_UPDATE, sessId)
     store.dispatch(flow.NOTIFICATION_ADD, 'Connected')
-    flowService.sessionLoad(undefined, sessId)
+    // Allow any persisted thing to be send first if any
+    setTimeout(() => {
+      const match = /.*\/s:(.*)/.exec(store.state.route.path)
+      let sessId
+      if (match != null) {
+        sessId = match[1]
+      }
+      // Make this in a service
+      if (sessId === undefined) {
+        flowService.sessionNew()
+        return
+      }
+      store.commit(flow.SESSID_UPDATE, sessId)
+      flowService.sessionLoad(undefined, sessId)
+    })
   })
 
   flowService.on('document', (v) => {