@liveblocks/core 3.20.0 → 3.20.1

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.js 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.20.0";
9
+ var PKG_VERSION = "3.20.1";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -8531,7 +8531,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
8531
8531
  const preciseSize = new TextEncoder().encode(jsonString).length;
8532
8532
  if (preciseSize > MAX_LIVE_OBJECT_SIZE) {
8533
8533
  throw new Error(
8534
- `LiveObject size exceeded limit: ${preciseSize} bytes > ${MAX_LIVE_OBJECT_SIZE} bytes. See https://liveblocks.io/docs/platform/limits#Liveblocks-Storage-limits`
8534
+ `LiveObject size exceeded limit: ${preciseSize} bytes > ${MAX_LIVE_OBJECT_SIZE} bytes. See https://liveblocks.io/docs/pricing/limits#Other-limits`
8535
8535
  );
8536
8536
  }
8537
8537
  }
@@ -9863,6 +9863,19 @@ function makeNodeMapBuffer() {
9863
9863
  }
9864
9864
  };
9865
9865
  }
9866
+ function topLevelKeysOf(nodes) {
9867
+ const keys2 = /* @__PURE__ */ new Set();
9868
+ const root = nodes.get("root");
9869
+ for (const key in root?.data) {
9870
+ keys2.add(key);
9871
+ }
9872
+ for (const node of nodes.values()) {
9873
+ if (node.parentId === "root") {
9874
+ keys2.add(node.parentKey);
9875
+ }
9876
+ }
9877
+ return keys2;
9878
+ }
9866
9879
  function createRoom(options, config) {
9867
9880
  const roomId = config.roomId;
9868
9881
  const initialPresence = options.initialPresence;
@@ -10149,10 +10162,11 @@ function createRoom(options, config) {
10149
10162
  );
10150
10163
  }
10151
10164
  const canWrite = self.get()?.canWrite ?? true;
10165
+ const serverTopLevelKeys = topLevelKeysOf(nodes);
10152
10166
  const root = context.root;
10153
10167
  disableHistory(() => {
10154
10168
  for (const key in context.initialStorage) {
10155
- if (root.get(key) === void 0) {
10169
+ if (!serverTopLevelKeys.has(key)) {
10156
10170
  if (canWrite) {
10157
10171
  root.set(key, cloneLson(context.initialStorage[key]));
10158
10172
  } else {