vim-web 0.3.44-dev.78 → 0.3.44-dev.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -78,7 +78,7 @@ export declare class StateSynchronizer {
78
78
  */
79
79
  replaceState(fromState: NodeState | NodeState[], toState: NodeState): void;
80
80
  /**
81
- * Reapplies all current state settings, useful after changes to the node structure.
81
+ * Reapplies all current state settings, useful after a reconnection.
82
82
  * This will remove redundant overrides and ensure consistency.
83
83
  */
84
84
  reapplyStates(): void;
@@ -60226,7 +60226,7 @@ void main() {
60226
60226
  this.scheduleUpdate();
60227
60227
  }
60228
60228
  /**
60229
- * Reapplies all current state settings, useful after changes to the node structure.
60229
+ * Reapplies all current state settings, useful after a reconnection.
60230
60230
  * This will remove redundant overrides and ensure consistency.
60231
60231
  */
60232
60232
  reapplyStates() {
@@ -60479,16 +60479,29 @@ void main() {
60479
60479
  * @param toState - The new state to apply
60480
60480
  */
60481
60481
  replace(fromState, toState) {
60482
+ this.purge();
60482
60483
  if (matchesState(this._default, fromState)) {
60483
60484
  this._default = toState;
60484
60485
  this._updatedDefault = true;
60486
+ this.reapply();
60487
+ return;
60485
60488
  }
60486
60489
  for (const [nodeId, state] of this._state.entries()) {
60487
60490
  if (matchesState(state, fromState)) {
60488
60491
  this._state.set(nodeId, toState);
60492
+ this._updates.add(nodeId);
60489
60493
  }
60490
60494
  }
60491
- this.reapply();
60495
+ }
60496
+ // Clean up redundant overrides
60497
+ purge() {
60498
+ const toRemove = [];
60499
+ for (const [nodeId, state] of this._state.entries()) {
60500
+ if (state === this._default) {
60501
+ toRemove.push(nodeId);
60502
+ }
60503
+ }
60504
+ toRemove.forEach((nodeId) => this._state.delete(nodeId));
60492
60505
  }
60493
60506
  }
60494
60507
  function matchesState(nodeState, state) {