@yorkie-js/react 0.7.12-rc → 0.7.12
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.d.ts +27 -1
- package/dist/yorkie-js-react.es.js +129 -16
- package/dist/yorkie-js-react.es.js.map +1 -1
- package/dist/yorkie-js-react.js +129 -16
- package/dist/yorkie-js-react.js.map +1 -1
- package/package.json +2 -2
|
@@ -99,7 +99,7 @@ declare type DocumentContextType<R, P extends Indexable = Indexable> = {
|
|
|
99
99
|
* This component must be under a `YorkieProvider` component to initialize the
|
|
100
100
|
* Yorkie client properly.
|
|
101
101
|
*/
|
|
102
|
-
export declare const DocumentProvider: <R, P extends Indexable = Indexable>({ docKey, initialRoot, initialPresence, enableDevtools, syncMode, documentPollInterval, disableGC, children, }: {
|
|
102
|
+
export declare const DocumentProvider: <R, P extends Indexable = Indexable>({ docKey, initialRoot, initialPresence, enableDevtools, syncMode, documentPollInterval, disableGC, disablePresence, children, }: {
|
|
103
103
|
docKey: string;
|
|
104
104
|
initialRoot?: R;
|
|
105
105
|
initialPresence?: P;
|
|
@@ -121,6 +121,15 @@ export declare const DocumentProvider: <R, P extends Indexable = Indexable>({ do
|
|
|
121
121
|
* GC behavior on this client.
|
|
122
122
|
*/
|
|
123
123
|
disableGC?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* `disablePresence` declares that this document does not use presence.
|
|
126
|
+
* Forwarded to both `new Document(...)` and `client.attach(...)`. The
|
|
127
|
+
* server fixates the value on first attach — subsequent attaches
|
|
128
|
+
* inherit the server's value regardless of what this prop carries.
|
|
129
|
+
* Useful for counter-only documents where the per-client presence
|
|
130
|
+
* map would otherwise leak memory.
|
|
131
|
+
*/
|
|
132
|
+
disablePresence?: boolean;
|
|
124
133
|
children?: default_2.ReactNode;
|
|
125
134
|
}) => JSX.Element;
|
|
126
135
|
|
|
@@ -290,6 +299,16 @@ export declare const usePresences: <P extends Indexable = Indexable>() => Array<
|
|
|
290
299
|
presence: P;
|
|
291
300
|
}>;
|
|
292
301
|
|
|
302
|
+
/**
|
|
303
|
+
* `useRemoveDocument` returns a function that removes the current document
|
|
304
|
+
* from the server via `client.remove` (as opposed to `client.detach`).
|
|
305
|
+
* After it resolves the document is gone for every client and the key can
|
|
306
|
+
* be reattached as a fresh document. The returned function rejects until
|
|
307
|
+
* the document is attached, and the removal error is propagated to the
|
|
308
|
+
* caller. This hook must be used within a `DocumentProvider`.
|
|
309
|
+
*/
|
|
310
|
+
export declare const useRemoveDocument: <R, P extends Indexable = Indexable>() => () => Promise<void>;
|
|
311
|
+
|
|
293
312
|
/**
|
|
294
313
|
* `useRevisions` is a custom hook that provides revision management methods
|
|
295
314
|
* for the current document. It wraps the client's revision API methods
|
|
@@ -342,6 +361,13 @@ export declare function useYorkieDoc<R, P extends Indexable = Indexable>(apiKey:
|
|
|
342
361
|
* GC behavior on this client.
|
|
343
362
|
*/
|
|
344
363
|
disableGC?: boolean;
|
|
364
|
+
/**
|
|
365
|
+
* `disablePresence` declares that this document does not use presence.
|
|
366
|
+
* Forwarded to both `new Document(...)` and `client.attach(...)`. The
|
|
367
|
+
* server fixates the value on first attach — subsequent attaches
|
|
368
|
+
* inherit the server's value regardless of what this option carries.
|
|
369
|
+
*/
|
|
370
|
+
disablePresence?: boolean;
|
|
345
371
|
}): {
|
|
346
372
|
root: R;
|
|
347
373
|
presences: Array<{
|
|
@@ -5867,7 +5867,7 @@ var DocEventType$1 = /* @__PURE__ */ ((DocEventType2) => {
|
|
|
5867
5867
|
DocEventType2[DocEventType2["DOCUMENT_BROADCAST"] = 3] = "DOCUMENT_BROADCAST";
|
|
5868
5868
|
return DocEventType2;
|
|
5869
5869
|
})(DocEventType$1 || {});
|
|
5870
|
-
const file_yorkie_v1_yorkie = /* @__PURE__ */ fileDesc("
|
|
5870
|
+
const file_yorkie_v1_yorkie = /* @__PURE__ */ fileDesc("ChZ5b3JraWUvdjEveW9ya2llLnByb3RvEgl5b3JraWUud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bFJlc3BvbnNlIgASSAoJQnJvYWRjYXN0EhsueW9ya2llLnYxLkJyb2FkY2FzdFJlcXVlc3QaHC55b3JraWUudjEuQnJvYWRjYXN0UmVzcG9uc2UiAEJFChFkZXYueW9ya2llLmFwaS52MVABWi5naXRodWIuY29tL3lvcmtpZS10ZWFtL3lvcmtpZS9hcGkveW9ya2llL3YxO3YxYgZwcm90bzM", [file_yorkie_v1_resources]);
|
|
5871
5871
|
const YorkieService = /* @__PURE__ */ serviceDesc(file_yorkie_v1_yorkie, 0);
|
|
5872
5872
|
const file_google_rpc_error_details = /* @__PURE__ */ fileDesc("Ch5nb29nbGUvcnBjL2Vycm9yX2RldGFpbHMucHJvdG8SCmdvb2dsZS5ycGMikwEKCUVycm9ySW5mbxIOCgZyZWFzb24YASABKAkSDgoGZG9tYWluGAIgASgJEjUKCG1ldGFkYXRhGAMgAygLMiMuZ29vZ2xlLnJwYy5FcnJvckluZm8uTWV0YWRhdGFFbnRyeRovCg1NZXRhZGF0YUVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEiOwoJUmV0cnlJbmZvEi4KC3JldHJ5X2RlbGF5GAEgASgLMhkuZ29vZ2xlLnByb3RvYnVmLkR1cmF0aW9uIjIKCURlYnVnSW5mbxIVCg1zdGFja19lbnRyaWVzGAEgAygJEg4KBmRldGFpbBgCIAEoCSKPAwoMUXVvdGFGYWlsdXJlEjYKCnZpb2xhdGlvbnMYASADKAsyIi5nb29nbGUucnBjLlF1b3RhRmFpbHVyZS5WaW9sYXRpb24axgIKCVZpb2xhdGlvbhIPCgdzdWJqZWN0GAEgASgJEhMKC2Rlc2NyaXB0aW9uGAIgASgJEhMKC2FwaV9zZXJ2aWNlGAMgASgJEhQKDHF1b3RhX21ldHJpYxgEIAEoCRIQCghxdW90YV9pZBgFIAEoCRJRChBxdW90YV9kaW1lbnNpb25zGAYgAygLMjcuZ29vZ2xlLnJwYy5RdW90YUZhaWx1cmUuVmlvbGF0aW9uL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oOY29tLmdvb2dsZS5ycGNCEUVycm9yRGV0YWlsc1Byb3RvUAFaP2dvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvcnBjL2VycmRldGFpbHM7ZXJyZGV0YWlsc6ICA1JQQ2IGcHJvdG8z", [file_google_protobuf_duration]);
|
|
5873
5873
|
const ErrorInfoSchema = /* @__PURE__ */ messageDesc(file_google_rpc_error_details, 0);
|
|
@@ -17025,6 +17025,25 @@ class ChangeContext {
|
|
|
17025
17025
|
setPresenceChange(presenceChange) {
|
|
17026
17026
|
this.presenceChange = presenceChange;
|
|
17027
17027
|
}
|
|
17028
|
+
/**
|
|
17029
|
+
* `hasPresenceChange` returns whether a presence change was registered
|
|
17030
|
+
* during this context. Used by `Document.update` to detect a presence
|
|
17031
|
+
* emit when the document was attached with `disablePresence: true`.
|
|
17032
|
+
*/
|
|
17033
|
+
hasPresenceChange() {
|
|
17034
|
+
return this.presenceChange !== void 0;
|
|
17035
|
+
}
|
|
17036
|
+
/**
|
|
17037
|
+
* `dropPresenceChange` clears any presence change registered during
|
|
17038
|
+
* this context. Used by `Document.update` to silently drop presence
|
|
17039
|
+
* emits on documents attached with `disablePresence: true`. After
|
|
17040
|
+
* dropping, the change carries only its operations (if any); when
|
|
17041
|
+
* the context was presence-only the resulting `hasChange()` returns
|
|
17042
|
+
* false and no `Change` is enqueued.
|
|
17043
|
+
*/
|
|
17044
|
+
dropPresenceChange() {
|
|
17045
|
+
this.presenceChange = void 0;
|
|
17046
|
+
}
|
|
17028
17047
|
/**
|
|
17029
17048
|
* `setReversePresence` registers the previous presence to undo presence updates.
|
|
17030
17049
|
*/
|
|
@@ -17048,6 +17067,16 @@ class ChangeContext {
|
|
|
17048
17067
|
}
|
|
17049
17068
|
return reversePresence;
|
|
17050
17069
|
}
|
|
17070
|
+
/**
|
|
17071
|
+
* `clearReversePresence` discards any reverse-presence keys recorded
|
|
17072
|
+
* during this context. Used by `Document.update` alongside
|
|
17073
|
+
* `dropPresenceChange` for documents attached with
|
|
17074
|
+
* `disablePresence: true`, so the dropped presence emit does not push
|
|
17075
|
+
* a no-op undo entry onto the history stack.
|
|
17076
|
+
*/
|
|
17077
|
+
clearReversePresence() {
|
|
17078
|
+
this.reversePresenceKeys.clear();
|
|
17079
|
+
}
|
|
17051
17080
|
/**
|
|
17052
17081
|
* `issueTimeTicket` creates a time ticket to be used to create a new operation.
|
|
17053
17082
|
*/
|
|
@@ -20099,6 +20128,17 @@ class Document {
|
|
|
20099
20128
|
// remote actors' version vectors into changeID, keeping each subsequent
|
|
20100
20129
|
// local Change's VV at O(1) for high-fan-out Counter workloads.
|
|
20101
20130
|
disableGC;
|
|
20131
|
+
// `disablePresence`, when true, declares that this document does not use
|
|
20132
|
+
// presence. The client sets it from the local option on construction and
|
|
20133
|
+
// overwrites it from the server-fixated value in the attach response. While
|
|
20134
|
+
// true, `Document.update`'s `presence.set` calls are silently dropped on
|
|
20135
|
+
// the way out (server enforcement is authoritative for the wire side).
|
|
20136
|
+
disablePresence;
|
|
20137
|
+
// `presenceDropWarned` ensures the silent-drop warning emitted by
|
|
20138
|
+
// `Document.update` for opt-in documents fires only once per document
|
|
20139
|
+
// lifetime. Otherwise long-lived counter-only documents would spam the
|
|
20140
|
+
// console on every well-meaning `presence.set` call.
|
|
20141
|
+
presenceDropWarned;
|
|
20102
20142
|
/**
|
|
20103
20143
|
* `history` is exposed to the user to manage undo/redo operations.
|
|
20104
20144
|
*/
|
|
@@ -20113,6 +20153,8 @@ class Document {
|
|
|
20113
20153
|
this.checkpoint = InitialCheckpoint;
|
|
20114
20154
|
this.localChanges = [];
|
|
20115
20155
|
this.disableGC = false;
|
|
20156
|
+
this.disablePresence = !!opts?.disablePresence;
|
|
20157
|
+
this.presenceDropWarned = false;
|
|
20116
20158
|
this.root = CRDTRoot.create();
|
|
20117
20159
|
this.presences = /* @__PURE__ */ new Map();
|
|
20118
20160
|
this.onlineClients = /* @__PURE__ */ new Set();
|
|
@@ -20160,6 +20202,16 @@ class Document {
|
|
|
20160
20202
|
} finally {
|
|
20161
20203
|
this.isUpdating = false;
|
|
20162
20204
|
}
|
|
20205
|
+
if (this.disablePresence && ctx.hasPresenceChange()) {
|
|
20206
|
+
ctx.dropPresenceChange();
|
|
20207
|
+
ctx.clearReversePresence();
|
|
20208
|
+
if (!this.presenceDropWarned) {
|
|
20209
|
+
this.presenceDropWarned = true;
|
|
20210
|
+
logger.warn(
|
|
20211
|
+
`[Document] "${this.key}" was attached with disablePresence=true; presence updates from Document.update are silently dropped.`
|
|
20212
|
+
);
|
|
20213
|
+
}
|
|
20214
|
+
}
|
|
20163
20215
|
const rules = this.getSchemaRules();
|
|
20164
20216
|
if (!ctx.isPresenceOnlyChange() && rules.length) {
|
|
20165
20217
|
const result = validateYorkieRuleset(this.clone?.root.getObject(), rules);
|
|
@@ -20529,6 +20581,24 @@ class Document {
|
|
|
20529
20581
|
setDisableGC(disableGC) {
|
|
20530
20582
|
this.disableGC = disableGC;
|
|
20531
20583
|
}
|
|
20584
|
+
/**
|
|
20585
|
+
* `setDisablePresence` records the server-fixated presence-disabled state
|
|
20586
|
+
* of this document. The client calls this on attach (before
|
|
20587
|
+
* `applyChangePack`) so any subsequent `Document.update` invocation sees
|
|
20588
|
+
* the gating state already settled. Flipping the flag at runtime is
|
|
20589
|
+
* supported: the next `update` honours the new value.
|
|
20590
|
+
*/
|
|
20591
|
+
setDisablePresence(disablePresence) {
|
|
20592
|
+
this.disablePresence = disablePresence;
|
|
20593
|
+
}
|
|
20594
|
+
/**
|
|
20595
|
+
* `isPresenceDisabled` returns the current presence-disabled state of
|
|
20596
|
+
* this document. Reflects the server-fixated value once attached;
|
|
20597
|
+
* before attach it reflects the local construction option.
|
|
20598
|
+
*/
|
|
20599
|
+
isPresenceDisabled() {
|
|
20600
|
+
return this.disablePresence;
|
|
20601
|
+
}
|
|
20532
20602
|
/**
|
|
20533
20603
|
* `isEnableDevtools` returns whether devtools is enabled or not.
|
|
20534
20604
|
*/
|
|
@@ -21266,6 +21336,14 @@ class Attachment {
|
|
|
21266
21336
|
* omit the response VersionVector. Documents only.
|
|
21267
21337
|
*/
|
|
21268
21338
|
disableGC;
|
|
21339
|
+
/**
|
|
21340
|
+
* `disablePresence` mirrors the server-fixated value returned by the
|
|
21341
|
+
* attach response. `pushPullChanges` does **not** read this — the
|
|
21342
|
+
* `disable_presence` wire field is request-only (set on the first
|
|
21343
|
+
* attach, ignored thereafter on the server side). Carried here for
|
|
21344
|
+
* devtools / debugging visibility. Documents only.
|
|
21345
|
+
*/
|
|
21346
|
+
disablePresence;
|
|
21269
21347
|
/**
|
|
21270
21348
|
* `unsubscribeLocalBroadcast` is set by `attachChannel` when it forwards
|
|
21271
21349
|
* a Channel's `local-broadcast` events to the RPC client, and consumed
|
|
@@ -21281,7 +21359,7 @@ class Attachment {
|
|
|
21281
21359
|
watchAbortController;
|
|
21282
21360
|
syncPromise;
|
|
21283
21361
|
_detaching = false;
|
|
21284
|
-
constructor(reconnectStreamDelay, resource, resourceID = "", syncMode, pollInterval = 0, pollIntervalPinned = false, disableGC = false) {
|
|
21362
|
+
constructor(reconnectStreamDelay, resource, resourceID = "", syncMode, pollInterval = 0, pollIntervalPinned = false, disableGC = false, disablePresence = false) {
|
|
21285
21363
|
this.reconnectStreamDelay = reconnectStreamDelay;
|
|
21286
21364
|
this.resource = resource;
|
|
21287
21365
|
this.resourceID = resourceID;
|
|
@@ -21291,6 +21369,7 @@ class Attachment {
|
|
|
21291
21369
|
this.pollInterval = pollInterval;
|
|
21292
21370
|
this.pollIntervalPinned = pollIntervalPinned;
|
|
21293
21371
|
this.disableGC = disableGC;
|
|
21372
|
+
this.disablePresence = disablePresence;
|
|
21294
21373
|
this.cancelled = false;
|
|
21295
21374
|
}
|
|
21296
21375
|
/**
|
|
@@ -21450,7 +21529,7 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
21450
21529
|
};
|
|
21451
21530
|
}
|
|
21452
21531
|
const name$1 = "@yorkie-js/sdk";
|
|
21453
|
-
const version$1 = "0.7.12
|
|
21532
|
+
const version$1 = "0.7.12";
|
|
21454
21533
|
const pkg$1 = {
|
|
21455
21534
|
name: name$1,
|
|
21456
21535
|
version: version$1
|
|
@@ -21751,7 +21830,8 @@ const DefaultClientOptions = {
|
|
|
21751
21830
|
syncLoopDuration: 50,
|
|
21752
21831
|
retrySyncLoopDelay: 1e3,
|
|
21753
21832
|
reconnectStreamDelay: 1e3,
|
|
21754
|
-
channelHeartbeatInterval: DefaultChannelHeartbeatMs
|
|
21833
|
+
channelHeartbeatInterval: DefaultChannelHeartbeatMs,
|
|
21834
|
+
deactivateOnUnload: true
|
|
21755
21835
|
};
|
|
21756
21836
|
const DefaultBroadcastOptions = {
|
|
21757
21837
|
maxRetries: Infinity,
|
|
@@ -21771,6 +21851,7 @@ class Client {
|
|
|
21771
21851
|
reconnectStreamDelay;
|
|
21772
21852
|
retrySyncLoopDelay;
|
|
21773
21853
|
channelHeartbeatInterval;
|
|
21854
|
+
deactivateOnUnload;
|
|
21774
21855
|
rpcClient;
|
|
21775
21856
|
setAuthToken;
|
|
21776
21857
|
taskQueue;
|
|
@@ -21804,6 +21885,7 @@ class Client {
|
|
|
21804
21885
|
this.reconnectStreamDelay = opts.reconnectStreamDelay ?? DefaultClientOptions.reconnectStreamDelay;
|
|
21805
21886
|
this.retrySyncLoopDelay = opts.retrySyncLoopDelay ?? DefaultClientOptions.retrySyncLoopDelay;
|
|
21806
21887
|
this.channelHeartbeatInterval = opts.channelHeartbeatInterval ?? DefaultClientOptions.channelHeartbeatInterval;
|
|
21888
|
+
this.deactivateOnUnload = opts.deactivateOnUnload ?? DefaultClientOptions.deactivateOnUnload;
|
|
21807
21889
|
const { authInterceptor, setToken } = createAuthInterceptor(this.apiKey);
|
|
21808
21890
|
this.setAuthToken = setToken;
|
|
21809
21891
|
const transportOptions = {
|
|
@@ -21882,9 +21964,14 @@ class Client {
|
|
|
21882
21964
|
this.deactivating = false;
|
|
21883
21965
|
this.runSyncLoop();
|
|
21884
21966
|
logger.info(`[AC] c:"${this.getKey()}" activated, id:"${this.id}"`);
|
|
21885
|
-
if (typeof window !== "undefined") {
|
|
21886
|
-
window.addEventListener("beforeunload",
|
|
21887
|
-
|
|
21967
|
+
if (typeof window !== "undefined" && this.deactivateOnUnload) {
|
|
21968
|
+
window.addEventListener("beforeunload", () => {
|
|
21969
|
+
void this.deactivate({ keepalive: true }).catch((err) => {
|
|
21970
|
+
logger.debug(
|
|
21971
|
+
`[DC] c:"${this.getKey()}" beforeunload deactivate failed:`,
|
|
21972
|
+
err
|
|
21973
|
+
);
|
|
21974
|
+
});
|
|
21888
21975
|
});
|
|
21889
21976
|
}
|
|
21890
21977
|
} catch (err) {
|
|
@@ -21972,7 +22059,10 @@ class Client {
|
|
|
21972
22059
|
);
|
|
21973
22060
|
}
|
|
21974
22061
|
doc.setActor(this.id);
|
|
21975
|
-
|
|
22062
|
+
const resolvedDisablePresence = opts.disablePresence ?? doc.isPresenceDisabled() ?? false;
|
|
22063
|
+
if (!resolvedDisablePresence) {
|
|
22064
|
+
doc.update((_, p) => p.set(opts.initialPresence || {}));
|
|
22065
|
+
}
|
|
21976
22066
|
const syncMode = opts.syncMode ?? "realtime";
|
|
21977
22067
|
if (opts.documentPollInterval !== void 0 && opts.documentPollInterval <= 0) {
|
|
21978
22068
|
throw new YorkieError(
|
|
@@ -21989,7 +22079,8 @@ class Client {
|
|
|
21989
22079
|
clientId: this.id,
|
|
21990
22080
|
changePack: converter.toChangePack(doc.createChangePack()),
|
|
21991
22081
|
schemaKey: opts.schema,
|
|
21992
|
-
disableGc: opts.disableGC ?? false
|
|
22082
|
+
disableGc: opts.disableGC ?? false,
|
|
22083
|
+
disablePresence: resolvedDisablePresence
|
|
21993
22084
|
},
|
|
21994
22085
|
{ headers: { "x-shard-key": `${this.apiKey}/${doc.getKey()}` } }
|
|
21995
22086
|
);
|
|
@@ -22002,6 +22093,7 @@ class Client {
|
|
|
22002
22093
|
}
|
|
22003
22094
|
const pack = converter.fromChangePack(res.changePack);
|
|
22004
22095
|
doc.setDisableGC(opts.disableGC ?? false);
|
|
22096
|
+
doc.setDisablePresence(res.disablePresence);
|
|
22005
22097
|
doc.applyChangePack(pack);
|
|
22006
22098
|
if (doc.getStatus() === DocStatus.Removed) {
|
|
22007
22099
|
return doc;
|
|
@@ -22016,7 +22108,8 @@ class Client {
|
|
|
22016
22108
|
syncMode,
|
|
22017
22109
|
pollInterval,
|
|
22018
22110
|
pollIntervalPinned,
|
|
22019
|
-
opts.disableGC ?? false
|
|
22111
|
+
opts.disableGC ?? false,
|
|
22112
|
+
res.disablePresence
|
|
22020
22113
|
)
|
|
22021
22114
|
);
|
|
22022
22115
|
if (syncMode !== "manual" && syncMode !== "polling") {
|
|
@@ -23534,7 +23627,7 @@ if (typeof globalThis !== "undefined") {
|
|
|
23534
23627
|
};
|
|
23535
23628
|
}
|
|
23536
23629
|
const name = "@yorkie-js/react";
|
|
23537
|
-
const version = "0.7.12
|
|
23630
|
+
const version = "0.7.12";
|
|
23538
23631
|
const pkg = {
|
|
23539
23632
|
name,
|
|
23540
23633
|
version
|
|
@@ -23575,7 +23668,7 @@ function useYorkieClient(opts, activate = true) {
|
|
|
23575
23668
|
}
|
|
23576
23669
|
activateClient();
|
|
23577
23670
|
return () => {
|
|
23578
|
-
if (activate && client?.isActive()) {
|
|
23671
|
+
if (activate && client?.isActive() && opts.deactivateOnUnload !== false) {
|
|
23579
23672
|
client.deactivate({ keepalive: true });
|
|
23580
23673
|
}
|
|
23581
23674
|
};
|
|
@@ -23723,7 +23816,7 @@ function shallowEqual(valueA, valueB) {
|
|
|
23723
23816
|
valueB
|
|
23724
23817
|
);
|
|
23725
23818
|
}
|
|
23726
|
-
function useYorkieDocument(client, clientLoading, clientError, docKey, initialRoot, initialPresence, enableDevtools, syncMode, documentPollInterval, disableGC, docStore) {
|
|
23819
|
+
function useYorkieDocument(client, clientLoading, clientError, docKey, initialRoot, initialPresence, enableDevtools, syncMode, documentPollInterval, disableGC, disablePresence, docStore) {
|
|
23727
23820
|
const initialRootRef = useRef(initialRoot);
|
|
23728
23821
|
const initialPresenceRef = useRef(initialPresence);
|
|
23729
23822
|
const [didMount, setDidMount] = useState(false);
|
|
@@ -23751,7 +23844,10 @@ function useYorkieDocument(client, clientLoading, clientError, docKey, initialRo
|
|
|
23751
23844
|
loading: true,
|
|
23752
23845
|
error: void 0
|
|
23753
23846
|
}));
|
|
23754
|
-
const newDoc = new Document(docKey, {
|
|
23847
|
+
const newDoc = new Document(docKey, {
|
|
23848
|
+
enableDevtools,
|
|
23849
|
+
disablePresence
|
|
23850
|
+
});
|
|
23755
23851
|
const unsubs = [];
|
|
23756
23852
|
unsubs.push(
|
|
23757
23853
|
newDoc.subscribe(() => {
|
|
@@ -23784,7 +23880,8 @@ function useYorkieDocument(client, clientLoading, clientError, docKey, initialRo
|
|
|
23784
23880
|
initialPresence: initialPresenceRef.current,
|
|
23785
23881
|
syncMode,
|
|
23786
23882
|
documentPollInterval,
|
|
23787
|
-
disableGC
|
|
23883
|
+
disableGC,
|
|
23884
|
+
disablePresence
|
|
23788
23885
|
});
|
|
23789
23886
|
const update = (callback) => {
|
|
23790
23887
|
try {
|
|
@@ -23833,7 +23930,8 @@ function useYorkieDocument(client, clientLoading, clientError, docKey, initialRo
|
|
|
23833
23930
|
didMount,
|
|
23834
23931
|
syncMode,
|
|
23835
23932
|
documentPollInterval,
|
|
23836
|
-
disableGC
|
|
23933
|
+
disableGC,
|
|
23934
|
+
disablePresence
|
|
23837
23935
|
]);
|
|
23838
23936
|
}
|
|
23839
23937
|
const DocumentContext = createContext(void 0);
|
|
@@ -23845,6 +23943,7 @@ const DocumentProvider = ({
|
|
|
23845
23943
|
syncMode,
|
|
23846
23944
|
documentPollInterval,
|
|
23847
23945
|
disableGC,
|
|
23946
|
+
disablePresence,
|
|
23848
23947
|
children
|
|
23849
23948
|
}) => {
|
|
23850
23949
|
const { client, loading: clientLoading, error: clientError } = useYorkie();
|
|
@@ -23873,6 +23972,7 @@ const DocumentProvider = ({
|
|
|
23873
23972
|
syncMode,
|
|
23874
23973
|
documentPollInterval,
|
|
23875
23974
|
disableGC,
|
|
23975
|
+
disablePresence,
|
|
23876
23976
|
documentStore
|
|
23877
23977
|
);
|
|
23878
23978
|
return /* @__PURE__ */ jsx(DocumentContext.Provider, { value: documentStore, children });
|
|
@@ -23948,6 +24048,17 @@ const useRevisions = () => {
|
|
|
23948
24048
|
);
|
|
23949
24049
|
return { createRevision, listRevisions, getRevision, restoreRevision };
|
|
23950
24050
|
};
|
|
24051
|
+
const useRemoveDocument = () => {
|
|
24052
|
+
const { client } = useYorkie();
|
|
24053
|
+
const documentStore = useDocumentStore("useRemoveDocument");
|
|
24054
|
+
const doc = useSelector(documentStore, (store) => store.doc);
|
|
24055
|
+
return useCallback(async () => {
|
|
24056
|
+
if (!client || !doc) {
|
|
24057
|
+
throw new Error("Client or document is not ready");
|
|
24058
|
+
}
|
|
24059
|
+
await client.remove(doc);
|
|
24060
|
+
}, [client, doc]);
|
|
24061
|
+
};
|
|
23951
24062
|
const useDocumentStore = (hookName) => {
|
|
23952
24063
|
const documentStore = useContext(DocumentContext);
|
|
23953
24064
|
if (!documentStore) {
|
|
@@ -23993,6 +24104,7 @@ function useYorkieDoc(apiKey, docKey, opts) {
|
|
|
23993
24104
|
opts?.syncMode,
|
|
23994
24105
|
opts?.documentPollInterval,
|
|
23995
24106
|
opts?.disableGC,
|
|
24107
|
+
opts?.disablePresence,
|
|
23996
24108
|
documentStore
|
|
23997
24109
|
);
|
|
23998
24110
|
const documentState = useSelector(documentStore);
|
|
@@ -24260,6 +24372,7 @@ export {
|
|
|
24260
24372
|
useDocument,
|
|
24261
24373
|
usePeekChannel,
|
|
24262
24374
|
usePresences,
|
|
24375
|
+
useRemoveDocument,
|
|
24263
24376
|
useRevisions,
|
|
24264
24377
|
useRoot,
|
|
24265
24378
|
useYorkie,
|