@yorkie-js/react 0.7.10 → 0.7.11-rc
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/yorkie-js-react.js
CHANGED
|
@@ -13770,6 +13770,26 @@
|
|
|
13770
13770
|
newID.versionVector.set(this.actor, lamport);
|
|
13771
13771
|
return newID;
|
|
13772
13772
|
}
|
|
13773
|
+
/**
|
|
13774
|
+
* `syncLamport` advances the lamport clock against the given ID without
|
|
13775
|
+
* merging its version vector into the receiver's. It is the counterpart
|
|
13776
|
+
* of `syncClocks` for attachments that have opted out of GC participation
|
|
13777
|
+
* (see docs/design/disable-gc-on-attach.md in the server repo): the
|
|
13778
|
+
* receiver does not need other actors' entries in its VV because it
|
|
13779
|
+
* never produces or consumes tombstones, and dropping them keeps each
|
|
13780
|
+
* subsequent local Change's VV at O(1) instead of O(num_actors).
|
|
13781
|
+
* Lamport must still advance so that TimeTickets produced locally
|
|
13782
|
+
* remain ordered against remote operations.
|
|
13783
|
+
*/
|
|
13784
|
+
syncLamport(other) {
|
|
13785
|
+
if (!other.hasClocks()) {
|
|
13786
|
+
return this;
|
|
13787
|
+
}
|
|
13788
|
+
const lamport = other.lamport > this.lamport ? other.lamport + 1n : this.lamport + 1n;
|
|
13789
|
+
const vector = this.versionVector.deepcopy();
|
|
13790
|
+
vector.set(this.actor, lamport);
|
|
13791
|
+
return new ChangeID(this.clientSeq, lamport, this.actor, vector);
|
|
13792
|
+
}
|
|
13773
13793
|
/**
|
|
13774
13794
|
* `setClocks` sets the given clocks to this ID. This is used when the snapshot
|
|
13775
13795
|
* is given from the server.
|
|
@@ -19641,6 +19661,12 @@
|
|
|
19641
19661
|
onlineClients;
|
|
19642
19662
|
eventStream;
|
|
19643
19663
|
eventStreamObserver;
|
|
19664
|
+
// `disableGC`, when true, declares that this document does not produce or
|
|
19665
|
+
// consume tombstones (see disable-gc-on-attach in the server repo). It is
|
|
19666
|
+
// set by the client on Attach and consumed by applyChange to skip merging
|
|
19667
|
+
// remote actors' version vectors into changeID, keeping each subsequent
|
|
19668
|
+
// local Change's VV at O(1) for high-fan-out Counter workloads.
|
|
19669
|
+
disableGC;
|
|
19644
19670
|
/**
|
|
19645
19671
|
* `history` is exposed to the user to manage undo/redo operations.
|
|
19646
19672
|
*/
|
|
@@ -19654,6 +19680,7 @@
|
|
|
19654
19680
|
this.changeID = InitialChangeID;
|
|
19655
19681
|
this.checkpoint = InitialCheckpoint;
|
|
19656
19682
|
this.localChanges = [];
|
|
19683
|
+
this.disableGC = false;
|
|
19657
19684
|
this.root = CRDTRoot.create();
|
|
19658
19685
|
this.presences = /* @__PURE__ */ new Map();
|
|
19659
19686
|
this.onlineClients = /* @__PURE__ */ new Set();
|
|
@@ -20062,6 +20089,14 @@
|
|
|
20062
20089
|
}
|
|
20063
20090
|
this.changeID = this.changeID.setActor(actorID);
|
|
20064
20091
|
}
|
|
20092
|
+
/**
|
|
20093
|
+
* `setDisableGC` records whether this document participates in GC. The
|
|
20094
|
+
* client calls this on attach so subsequent applyChange runs use the
|
|
20095
|
+
* lamport-only sync path.
|
|
20096
|
+
*/
|
|
20097
|
+
setDisableGC(disableGC) {
|
|
20098
|
+
this.disableGC = disableGC;
|
|
20099
|
+
}
|
|
20065
20100
|
/**
|
|
20066
20101
|
* `isEnableDevtools` returns whether devtools is enabled or not.
|
|
20067
20102
|
*/
|
|
@@ -20300,7 +20335,7 @@
|
|
|
20300
20335
|
);
|
|
20301
20336
|
}
|
|
20302
20337
|
}
|
|
20303
|
-
this.changeID = this.changeID.syncClocks(change.getID());
|
|
20338
|
+
this.changeID = this.disableGC ? this.changeID.syncLamport(change.getID()) : this.changeID.syncClocks(change.getID());
|
|
20304
20339
|
if (opInfos.length) {
|
|
20305
20340
|
const rawChange = this.isEnableDevtools() ? change.toStruct() : void 0;
|
|
20306
20341
|
events.push(
|
|
@@ -20983,7 +21018,7 @@
|
|
|
20983
21018
|
};
|
|
20984
21019
|
}
|
|
20985
21020
|
const name$1 = "@yorkie-js/sdk";
|
|
20986
|
-
const version$1 = "0.7.
|
|
21021
|
+
const version$1 = "0.7.11-rc";
|
|
20987
21022
|
const pkg$1 = {
|
|
20988
21023
|
name: name$1,
|
|
20989
21024
|
version: version$1
|
|
@@ -21534,6 +21569,7 @@
|
|
|
21534
21569
|
doc.setSchemaRules(converter.fromSchemaRules(res.schemaRules));
|
|
21535
21570
|
}
|
|
21536
21571
|
const pack = converter.fromChangePack(res.changePack);
|
|
21572
|
+
doc.setDisableGC(opts.disableGC ?? false);
|
|
21537
21573
|
doc.applyChangePack(pack);
|
|
21538
21574
|
if (doc.getStatus() === DocStatus.Removed) {
|
|
21539
21575
|
return doc;
|
|
@@ -23066,7 +23102,7 @@
|
|
|
23066
23102
|
};
|
|
23067
23103
|
}
|
|
23068
23104
|
const name = "@yorkie-js/react";
|
|
23069
|
-
const version = "0.7.
|
|
23105
|
+
const version = "0.7.11-rc";
|
|
23070
23106
|
const pkg = {
|
|
23071
23107
|
name,
|
|
23072
23108
|
version
|
|
@@ -23255,7 +23291,7 @@
|
|
|
23255
23291
|
valueB
|
|
23256
23292
|
);
|
|
23257
23293
|
}
|
|
23258
|
-
function useYorkieDocument(client, clientLoading, clientError, docKey, initialRoot, initialPresence, enableDevtools, syncMode, documentPollInterval, docStore) {
|
|
23294
|
+
function useYorkieDocument(client, clientLoading, clientError, docKey, initialRoot, initialPresence, enableDevtools, syncMode, documentPollInterval, disableGC, docStore) {
|
|
23259
23295
|
const initialRootRef = react.useRef(initialRoot);
|
|
23260
23296
|
const initialPresenceRef = react.useRef(initialPresence);
|
|
23261
23297
|
const [didMount, setDidMount] = react.useState(false);
|
|
@@ -23315,7 +23351,8 @@
|
|
|
23315
23351
|
initialRoot: initialRootRef.current,
|
|
23316
23352
|
initialPresence: initialPresenceRef.current,
|
|
23317
23353
|
syncMode,
|
|
23318
|
-
documentPollInterval
|
|
23354
|
+
documentPollInterval,
|
|
23355
|
+
disableGC
|
|
23319
23356
|
});
|
|
23320
23357
|
const update = (callback) => {
|
|
23321
23358
|
try {
|
|
@@ -23363,7 +23400,8 @@
|
|
|
23363
23400
|
docStore,
|
|
23364
23401
|
didMount,
|
|
23365
23402
|
syncMode,
|
|
23366
|
-
documentPollInterval
|
|
23403
|
+
documentPollInterval,
|
|
23404
|
+
disableGC
|
|
23367
23405
|
]);
|
|
23368
23406
|
}
|
|
23369
23407
|
const DocumentContext = react.createContext(void 0);
|
|
@@ -23374,6 +23412,7 @@
|
|
|
23374
23412
|
enableDevtools = false,
|
|
23375
23413
|
syncMode,
|
|
23376
23414
|
documentPollInterval,
|
|
23415
|
+
disableGC,
|
|
23377
23416
|
children
|
|
23378
23417
|
}) => {
|
|
23379
23418
|
const { client, loading: clientLoading, error: clientError } = useYorkie();
|
|
@@ -23401,6 +23440,7 @@
|
|
|
23401
23440
|
enableDevtools,
|
|
23402
23441
|
syncMode,
|
|
23403
23442
|
documentPollInterval,
|
|
23443
|
+
disableGC,
|
|
23404
23444
|
documentStore
|
|
23405
23445
|
);
|
|
23406
23446
|
return /* @__PURE__ */ jsxRuntime.jsx(DocumentContext.Provider, { value: documentStore, children });
|
|
@@ -23520,6 +23560,7 @@
|
|
|
23520
23560
|
opts?.enableDevtools ?? false,
|
|
23521
23561
|
opts?.syncMode,
|
|
23522
23562
|
opts?.documentPollInterval,
|
|
23563
|
+
opts?.disableGC,
|
|
23523
23564
|
documentStore
|
|
23524
23565
|
);
|
|
23525
23566
|
const documentState = useSelector(documentStore);
|