File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -460,13 +460,15 @@ class VuexBackend {
460
460
}
461
461
462
462
// Optimization: periodically cache snapshots
463
- if ( i !== index && i % SharedData . cacheVuexSnapshotsEvery === 0 ) {
463
+ if ( i === index || ( i % SharedData . cacheVuexSnapshotsEvery === 0 ) ) {
464
464
this . cacheStateSnapshot ( i )
465
465
}
466
466
}
467
467
468
468
// Send final state after replay
469
469
resultState = clone ( this . store . state )
470
+
471
+ if ( ! isProd ) console . log ( `replayed ${ index - stateSnapshot . index } mutation(s)` )
470
472
}
471
473
472
474
this . lastState = resultState
@@ -501,10 +503,14 @@ class VuexBackend {
501
503
state : clone ( this . store . state ) ,
502
504
permanent
503
505
} )
506
+ if ( ! isProd ) console . log ( 'cached snapshot' , index )
504
507
// Delete old cached snapshots
505
508
if ( this . stateSnapshotCache . filter ( s => ! s . permanent ) . length > SharedData . cacheVuexSnapshotsLimit ) {
506
509
const i = this . stateSnapshotCache . findIndex ( s => ! s . permanent )
507
- if ( i !== - 1 ) this . stateSnapshotCache . splice ( i , 1 )
510
+ if ( i !== - 1 ) {
511
+ if ( ! isProd ) console . log ( 'clean cached snapshot' , this . stateSnapshotCache [ i ] . index )
512
+ this . stateSnapshotCache . splice ( i , 1 )
513
+ }
508
514
}
509
515
}
510
516
You can’t perform that action at this time.
0 commit comments