@yorkie-js/react 0.6.10 → 0.6.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.
|
@@ -5,7 +5,7 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { createContext, useMemo, useState, useEffect, useContext, useCallback } from "react";
|
|
7
7
|
const name$1 = "@yorkie-js/react";
|
|
8
|
-
const version$1 = "0.6.
|
|
8
|
+
const version$1 = "0.6.11-rc";
|
|
9
9
|
const pkg$1 = {
|
|
10
10
|
name: name$1,
|
|
11
11
|
version: version$1
|
|
@@ -20418,7 +20418,7 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
20418
20418
|
};
|
|
20419
20419
|
}
|
|
20420
20420
|
const name = "@yorkie-js/sdk";
|
|
20421
|
-
const version = "0.6.
|
|
20421
|
+
const version = "0.6.11-rc";
|
|
20422
20422
|
const pkg = {
|
|
20423
20423
|
name,
|
|
20424
20424
|
version
|
|
@@ -20576,15 +20576,16 @@ class Client {
|
|
|
20576
20576
|
if (this.status === "deactivated") {
|
|
20577
20577
|
return Promise.resolve();
|
|
20578
20578
|
}
|
|
20579
|
+
this.deactivateInternal();
|
|
20579
20580
|
const task = async () => {
|
|
20580
20581
|
try {
|
|
20581
20582
|
await this.rpcClient.deactivateClient(
|
|
20582
20583
|
{ clientId: this.id },
|
|
20583
20584
|
{ headers: { "x-shard-key": this.apiKey } }
|
|
20584
20585
|
);
|
|
20585
|
-
this.deactivateInternal();
|
|
20586
20586
|
logger.info(`[DC] c"${this.getKey()}" deactivated`);
|
|
20587
20587
|
} catch (err) {
|
|
20588
|
+
this.status = "activated";
|
|
20588
20589
|
logger.error(`[DC] c:"${this.getKey()}" err :`, err);
|
|
20589
20590
|
await this.handleConnectError(err);
|
|
20590
20591
|
throw err;
|
|
@@ -20668,12 +20669,12 @@ class Client {
|
|
|
20668
20669
|
await this.runWatchLoop(doc.getKey());
|
|
20669
20670
|
}
|
|
20670
20671
|
logger.info(`[AD] c:"${this.getKey()}" attaches d:"${doc.getKey()}"`);
|
|
20671
|
-
const
|
|
20672
|
+
const crdtRoot = doc.getRootObject();
|
|
20672
20673
|
if (opts.initialRoot) {
|
|
20673
20674
|
const initialRoot = opts.initialRoot;
|
|
20674
20675
|
doc.update((root) => {
|
|
20675
20676
|
for (const [k, v] of Object.entries(initialRoot)) {
|
|
20676
|
-
if (!
|
|
20677
|
+
if (!crdtRoot.has(k)) {
|
|
20677
20678
|
const key = k;
|
|
20678
20679
|
root[key] = v;
|
|
20679
20680
|
}
|
|
@@ -20696,7 +20697,7 @@ class Client {
|
|
|
20696
20697
|
* the changes should be applied to other replicas before GC time. For this,
|
|
20697
20698
|
* if the document is no longer used by this client, it should be detached.
|
|
20698
20699
|
*/
|
|
20699
|
-
detach(doc, opts = {
|
|
20700
|
+
detach(doc, opts = { removeIfNotAttached: false }) {
|
|
20700
20701
|
if (!this.isActive()) {
|
|
20701
20702
|
throw new YorkieError(
|
|
20702
20703
|
Code.ErrClientNotActivated,
|
|
@@ -20711,14 +20712,14 @@ class Client {
|
|
|
20711
20712
|
);
|
|
20712
20713
|
}
|
|
20713
20714
|
doc.update((_, p) => p.clear());
|
|
20714
|
-
|
|
20715
|
+
return this.enqueueTask(async () => {
|
|
20715
20716
|
try {
|
|
20716
20717
|
const res = await this.rpcClient.detachDocument(
|
|
20717
20718
|
{
|
|
20718
20719
|
clientId: this.id,
|
|
20719
20720
|
documentId: attachment.docID,
|
|
20720
20721
|
changePack: converter.toChangePack(doc.createChangePack()),
|
|
20721
|
-
removeIfNotAttached: opts.removeIfNotAttached
|
|
20722
|
+
removeIfNotAttached: opts.removeIfNotAttached
|
|
20722
20723
|
},
|
|
20723
20724
|
{ headers: { "x-shard-key": `${this.apiKey}/${doc.getKey()}` } }
|
|
20724
20725
|
);
|
|
@@ -20735,14 +20736,7 @@ class Client {
|
|
|
20735
20736
|
await this.handleConnectError(err);
|
|
20736
20737
|
throw err;
|
|
20737
20738
|
}
|
|
20738
|
-
};
|
|
20739
|
-
if (opts.keepalive) {
|
|
20740
|
-
this.keepalive = true;
|
|
20741
|
-
const resp = task();
|
|
20742
|
-
this.keepalive = false;
|
|
20743
|
-
return resp;
|
|
20744
|
-
}
|
|
20745
|
-
return this.enqueueTask(task);
|
|
20739
|
+
});
|
|
20746
20740
|
}
|
|
20747
20741
|
/**
|
|
20748
20742
|
* `changeRealtimeSync` changes the synchronization mode of the given document.
|