@linxin666/dsh-client-ui-task-board 0.2.3 → 0.2.4

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.
package/lib/client.js CHANGED
@@ -907,7 +907,10 @@ window.__ModuleLoader__.load({
907
907
  /** Settle tasks left 'running' whose sessions already finished. */
908
908
  async reconcileRunningTasks() {
909
909
  if (this.deps.exec === void 0) return;
910
- if (this.reconcileInFlight) return;
910
+ if (this.reconcileInFlight) {
911
+ this.scheduleReconcile();
912
+ return;
913
+ }
911
914
  this.reconcileInFlight = true;
912
915
  try {
913
916
  const events = [];
@@ -3449,7 +3452,8 @@ window.__ModuleLoader__.load({
3449
3452
  const valid = plan.filter((item) => item.run !== void 0);
3450
3453
  if (plan.length === 0 || this.saving || valid.length !== plan.length) return;
3451
3454
  const plannedWrites = valid.map((item) => item.op);
3452
- const fields = new Set(plan.map((item) => item.field));
3455
+ const pending = /* @__PURE__ */ new Map();
3456
+ for (const item of plan) pending.set(item.field, this.staged.get(item.field));
3453
3457
  this.saving = true;
3454
3458
  this.failed = false;
3455
3459
  this.failedReason = void 0;
@@ -3462,9 +3466,9 @@ window.__ModuleLoader__.load({
3462
3466
  for (const field of result.fields) if (field.landed) landed.add(field.field);
3463
3467
  } else this.failedReason = result.message;
3464
3468
  } else for (const item of valid) if (await item.run()) landed.add(item.field);
3465
- for (const field of fields) if (landed.has(field)) this.staged.delete(field);
3469
+ for (const [field, before] of pending) if (landed.has(field) && this.staged.get(field) === before) this.staged.delete(field);
3466
3470
  this.saving = false;
3467
- this.failed = landed.size !== fields.size;
3471
+ this.failed = landed.size !== pending.size;
3468
3472
  this.publish();
3469
3473
  }
3470
3474
  /** The scope's batch surface when it supports one; undefined conservatively otherwise. */