@liveblocks/core 2.0.3 → 2.0.4-test1

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.mjs 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 = "2.0.3";
9
+ var PKG_VERSION = "2.0.4-test1";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -5688,10 +5688,17 @@ function createRoom(options, config) {
5688
5688
  } else {
5689
5689
  context.root = LiveObject._fromItems(message.items, pool);
5690
5690
  }
5691
+ const canWrite = self.current?.canWrite ?? true;
5691
5692
  const stackSizeBefore = context.undoStack.length;
5692
5693
  for (const key in context.initialStorage) {
5693
5694
  if (context.root.get(key) === void 0) {
5694
- context.root.set(key, cloneLson(context.initialStorage[key]));
5695
+ if (canWrite) {
5696
+ context.root.set(key, cloneLson(context.initialStorage[key]));
5697
+ } else {
5698
+ warn(
5699
+ `Attempted to populate missing storage key '${key}', but current user has no write access`
5700
+ );
5701
+ }
5695
5702
  }
5696
5703
  }
5697
5704
  context.undoStack.length = stackSizeBefore;