@liveblocks/core 3.24.3-livetextreplay → 3.24.3
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 +28 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "3.24.3
|
|
9
|
+
var PKG_VERSION = "3.24.3";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -9852,6 +9852,7 @@ var LiveText = class _LiveText extends AbstractCrdt {
|
|
|
9852
9852
|
#acceptedOps = [];
|
|
9853
9853
|
/** Wait for replay history before applying post-snapshot remote ops. */
|
|
9854
9854
|
#reconnecting = false;
|
|
9855
|
+
#deferredHistorylessAck = false;
|
|
9855
9856
|
#bufferedRemoteOps = [];
|
|
9856
9857
|
/**
|
|
9857
9858
|
* Creates a new LiveText document.
|
|
@@ -9924,6 +9925,14 @@ var LiveText = class _LiveText extends AbstractCrdt {
|
|
|
9924
9925
|
throw new Error("LiveText cannot contain child nodes");
|
|
9925
9926
|
}
|
|
9926
9927
|
/** @internal */
|
|
9928
|
+
_deferAckWithoutHistory(op) {
|
|
9929
|
+
if (this.#reconnecting && !this.#deferredHistorylessAck && op.opId !== void 0 && op.opId === this.#inFlightOpId && op.history === void 0) {
|
|
9930
|
+
this.#deferredHistorylessAck = true;
|
|
9931
|
+
return true;
|
|
9932
|
+
}
|
|
9933
|
+
return false;
|
|
9934
|
+
}
|
|
9935
|
+
/** @internal */
|
|
9927
9936
|
_apply(op, source) {
|
|
9928
9937
|
if (op.type !== OpCode.UPDATE_TEXT) {
|
|
9929
9938
|
return super._apply(op, source);
|
|
@@ -10232,11 +10241,13 @@ var LiveText = class _LiveText extends AbstractCrdt {
|
|
|
10232
10241
|
}
|
|
10233
10242
|
/** Recover the missing server timeline, preserving the normal OT invariants. */
|
|
10234
10243
|
#reconcileAck(op, source) {
|
|
10235
|
-
const history =
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10244
|
+
const history = op.history;
|
|
10245
|
+
if (history === void 0) {
|
|
10246
|
+
this._rejectPendingOp(nn(op.opId));
|
|
10247
|
+
return { modified: false, needsStorageResync: true };
|
|
10248
|
+
}
|
|
10239
10249
|
this.#reconnecting = false;
|
|
10250
|
+
this.#deferredHistorylessAck = false;
|
|
10240
10251
|
const buffered = this.#bufferedRemoteOps;
|
|
10241
10252
|
this.#bufferedRemoteOps = [];
|
|
10242
10253
|
const changes = [];
|
|
@@ -10405,6 +10416,7 @@ var LiveText = class _LiveText extends AbstractCrdt {
|
|
|
10405
10416
|
_resyncText(data, version, source) {
|
|
10406
10417
|
if (this.#inFlightOpId !== void 0) {
|
|
10407
10418
|
this.#reconnecting = true;
|
|
10419
|
+
this.#deferredHistorylessAck = false;
|
|
10408
10420
|
return void 0;
|
|
10409
10421
|
}
|
|
10410
10422
|
this.#confirmed = dataToSegments(data);
|
|
@@ -10438,6 +10450,7 @@ var LiveText = class _LiveText extends AbstractCrdt {
|
|
|
10438
10450
|
this.#queuedOps = [];
|
|
10439
10451
|
this.#bufferedRemoteOps = [];
|
|
10440
10452
|
this.#reconnecting = false;
|
|
10453
|
+
this.#deferredHistorylessAck = false;
|
|
10441
10454
|
}
|
|
10442
10455
|
#recordAccepted(version, ops, opId) {
|
|
10443
10456
|
if (this.#acceptedOps.some((entry) => entry.version === version)) {
|
|
@@ -12372,6 +12385,12 @@ function createRoom(options, config) {
|
|
|
12372
12385
|
}
|
|
12373
12386
|
const createdNodeIds = /* @__PURE__ */ new Set();
|
|
12374
12387
|
for (const op of ops) {
|
|
12388
|
+
if (!isLocal && op.type === OpCode.UPDATE_TEXT && op.opId !== void 0) {
|
|
12389
|
+
const node = context.pool.nodes.get(op.id);
|
|
12390
|
+
if (node !== void 0 && isLiveText(node) && node._deferAckWithoutHistory(op)) {
|
|
12391
|
+
continue;
|
|
12392
|
+
}
|
|
12393
|
+
}
|
|
12375
12394
|
let source;
|
|
12376
12395
|
if (isLocal) {
|
|
12377
12396
|
source = { ...localSource, optimistic: true };
|
|
@@ -12386,6 +12405,10 @@ function createRoom(options, config) {
|
|
|
12386
12405
|
source = REMOTE;
|
|
12387
12406
|
}
|
|
12388
12407
|
const applyOpResult = applyOp(op, source);
|
|
12408
|
+
if ("needsStorageResync" in applyOpResult) {
|
|
12409
|
+
refreshStorage();
|
|
12410
|
+
flushNowOrSoon();
|
|
12411
|
+
}
|
|
12389
12412
|
if (applyOpResult.modified) {
|
|
12390
12413
|
const nodeId = applyOpResult.modified.node._id;
|
|
12391
12414
|
if (!(nodeId && createdNodeIds.has(nodeId))) {
|