@actuallab/rpc 13.0.167 → 14.0.17

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/dist/index.cjs CHANGED
@@ -1472,13 +1472,18 @@ var RpcStreamSender = class _RpcStreamSender {
1472
1472
  }
1473
1473
  }
1474
1474
  /* eslint-enable @typescript-eslint/no-unnecessary-condition */
1475
- /** Drain all queued ACKs, returning the most recent one (or null if none). */
1475
+ /** Drain all queued ACKs, returning the most recent one (or null if none).
1476
+ * A reconnect's reset ACK may be drained in one batch with regular
1477
+ * consumption ACKs the client sends right after it, so `mustReset` is
1478
+ * OR-ed over the whole batch — the last ACK alone can't represent it. */
1476
1479
  _tryProcessAcks() {
1477
1480
  if (this._acks.length === 0) return null;
1478
- let last = null;
1481
+ let nextIndex = 0;
1482
+ let mustReset = false;
1479
1483
  while (this._acks.length > 0) {
1480
1484
  const a = this._acks.shift();
1481
- last = a;
1485
+ nextIndex = a.nextIndex;
1486
+ mustReset ||= a.mustReset;
1482
1487
  if (a.mustReset || this._nextIndex < a.nextIndex) {
1483
1488
  this._nextIndex = a.nextIndex;
1484
1489
  }
@@ -1487,7 +1492,7 @@ var RpcStreamSender = class _RpcStreamSender {
1487
1492
  this.onAckProcessed?.();
1488
1493
  } catch {
1489
1494
  }
1490
- return last;
1495
+ return { nextIndex, mustReset };
1491
1496
  }
1492
1497
  /** Wait for the ACK queue to have at least one entry (or `_ended`). */
1493
1498
  async _waitAckReady() {