@@ -65,6 +65,9 @@ export const useMainStore = defineStore("main", {
65
65
split_vars : useLocalStorage ( "split_vars" , true ) ,
66
66
/** dark theme */
67
67
dark : useLocalStorage ( "dark_mode" , false ) ,
68
+
69
+ /** last save time */
70
+ lastSave : 0 ,
68
71
} ) ,
69
72
// optional getters
70
73
getters : {
@@ -156,6 +159,10 @@ export const useMainStore = defineStore("main", {
156
159
console . warn ( "no data to load" )
157
160
return
158
161
}
162
+ if ( Date . now ( ) - this . lastSave < 800 ) {
163
+ console . debug ( "ignoring changes from server" )
164
+ return
165
+ }
159
166
this . context = data . context as Context
160
167
console . debug ( "load layouts+" , data . options )
161
168
this . optHeight = Math . max ( 400 , Math . min ( 900 , data . options . height || 450 ) )
@@ -256,6 +263,7 @@ export const useMainStore = defineStore("main", {
256
263
save ( ) {
257
264
console . debug ( "save layouts+" , this . wsState . uidata )
258
265
wsSend ( this . wsState )
266
+ this . lastSave = Date . now ( )
259
267
} ,
260
268
261
269
/* process a received websock message */
@@ -318,17 +326,6 @@ export const useMainStore = defineStore("main", {
318
326
this . fetch_templates ( )
319
327
return
320
328
}
321
- if ( this . context . topofile . endsWith ( `/${ name } ` ) ) {
322
- console . error ( "topo file updated, should have received a WS msg" )
323
- return
324
- }
325
- if (
326
- this . context . topofile . endsWith ( `/${ name . replace ( ".labctl." , ".clab." ) } ` )
327
- ) {
328
- // updated when we move nodes
329
- // MsgWarning(`labctl file updated, you need to restart the labctl server`)
330
- return
331
- }
332
329
333
330
MsgWarning ( `unhandled file change: ${ name } ` )
334
331
} ,
0 commit comments