File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
services/static-webserver/client/source/class/osparc/desktop Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,26 @@ qx.Class.define("osparc.desktop.StudyEditor", {
316316 this . __listenToEvent ( ) ;
317317 this . __listenToServiceStatus ( ) ;
318318 this . __listenToStatePorts ( ) ;
319+
320+ const socket = osparc . wrapper . WebSocket . getInstance ( ) ;
321+ [
322+ "connect" ,
323+ "reconnect" ,
324+ ] . forEach ( evtName => {
325+ socket . addListener ( evtName , ( ) => {
326+ // after a reconnect, re-sync the project document
327+ console . log ( "WebSocket reconnected, re-syncing project document" ) ;
328+ const studyId = this . getStudy ( ) . getUuid ( ) ;
329+ osparc . store . Study . getInstance ( ) . getOne ( studyId )
330+ . then ( latestStudyData => {
331+ const latestData = {
332+ "version" : this . __lastSyncedProjectVersion , // do not increase the version
333+ "document" : latestStudyData ,
334+ } ;
335+ this . __applyProjectDocument ( latestData ) ;
336+ } ) ;
337+ } ) ;
338+ } ) ;
319339 } ,
320340
321341 __listenToProjectDocument : function ( ) {
You can’t perform that action at this time.
0 commit comments