@liveblocks/react 1.0.2 → 1.0.6-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/README.md CHANGED
@@ -32,8 +32,9 @@ npm install @liveblocks/client @liveblocks/react
32
32
 
33
33
  ## Documentation
34
34
 
35
- Read the [documentation](https://liveblocks.io/docs) for guides and API
36
- references.
35
+ Read the
36
+ [documentation](https://liveblocks.io/docs/api-reference/liveblocks-react) for
37
+ guides and API references.
37
38
 
38
39
  ## Examples
39
40
 
package/dist/index.js CHANGED
@@ -5,9 +5,7 @@ function ClientSideSuspense(props) {
5
5
  React.useEffect(() => {
6
6
  setMounted(true);
7
7
  }, []);
8
- return /* @__PURE__ */ React.createElement(React.Suspense, {
9
- fallback: props.fallback
10
- }, mounted ? props.children() : props.fallback);
8
+ return /* @__PURE__ */ React.createElement(React.Suspense, { fallback: props.fallback }, mounted ? props.children() : props.fallback);
11
9
  }
12
10
 
13
11
  // src/factory.tsx
@@ -24,6 +22,9 @@ var _withselector = require('use-sync-external-store/shim/with-selector');
24
22
 
25
23
  function useRerender() {
26
24
  const [, update] = _react.useReducer.call(void 0,
25
+ // This implementation works by incrementing a hidden counter value that is
26
+ // never consumed. Simply incrementing the counter changes the component's
27
+ // state and, thus, trigger a re-render.
27
28
  (x) => x + 1,
28
29
  0
29
30
  );
@@ -52,7 +53,10 @@ var superfluous_unstable_batchedUpdates = "You don\u2019t need to pass unstable_
52
53
  function useSyncExternalStore(s, gs, gss) {
53
54
  return _withselector.useSyncExternalStoreWithSelector.call(void 0, s, gs, gss, identity);
54
55
  }
55
- var EMPTY_OTHERS = _core.asArrayWithLegacyMethods.call(void 0, []);
56
+ var EMPTY_OTHERS = (
57
+ // NOTE: asArrayWithLegacyMethods() wrapping should no longer be necessary in 0.19
58
+ _core.asArrayWithLegacyMethods.call(void 0, [])
59
+ );
56
60
  function getEmptyOthers() {
57
61
  return EMPTY_OTHERS;
58
62
  }
@@ -140,9 +144,7 @@ function createRoomContext(client) {
140
144
  client.leave(roomId);
141
145
  };
142
146
  }, [roomId, frozen]);
143
- return /* @__PURE__ */ React2.createElement(RoomContext.Provider, {
144
- value: room
145
- }, props.children);
147
+ return /* @__PURE__ */ React2.createElement(RoomContext.Provider, { value: room }, props.children);
146
148
  }
147
149
  function connectionIdSelector(others) {
148
150
  return others.map((user) => user.connectionId);
@@ -340,6 +342,7 @@ function createRoomContext(client) {
340
342
  liveValue = newCrdt;
341
343
  unsubscribeCrdt = room.subscribe(
342
344
  liveValue,
345
+ // TODO: This is hiding a bug! If `liveValue` happens to be the string `"event"` this actually subscribes an event handler!
343
346
  rerender
344
347
  );
345
348
  rerender();
@@ -347,10 +350,12 @@ function createRoomContext(client) {
347
350
  }
348
351
  let unsubscribeCrdt = room.subscribe(
349
352
  liveValue,
353
+ // TODO: This is hiding a bug! If `liveValue` happens to be the string `"event"` this actually subscribes an event handler!
350
354
  rerender
351
355
  );
352
356
  const unsubscribeRoot = room.subscribe(
353
357
  root,
358
+ // TODO: This is hiding a bug! If `liveValue` happens to be the string `"event"` this actually subscribes an event handler!
354
359
  onRootChange
355
360
  );
356
361
  rerender();
@@ -429,6 +434,7 @@ function createRoomContext(client) {
429
434
  () => callback(makeMutationContext(room), ...args)
430
435
  );
431
436
  },
437
+ // eslint-disable-next-line react-hooks/exhaustive-deps
432
438
  [room, ...deps]
433
439
  );
434
440
  }
@@ -482,6 +488,7 @@ function createRoomContext(client) {
482
488
  useRedo,
483
489
  useCanRedo,
484
490
  useCanUndo,
491
+ // These are just aliases. The passed-in key will define their return values.
485
492
  useList: useLegacyKey,
486
493
  useMap: useLegacyKey,
487
494
  useObject: useLegacyKey,
@@ -508,6 +515,7 @@ function createRoomContext(client) {
508
515
  useRedo,
509
516
  useCanRedo,
510
517
  useCanUndo,
518
+ // Legacy hooks
511
519
  useList: useLegacyKeySuspense,
512
520
  useMap: useLegacyKeySuspense,
513
521
  useObject: useLegacyKeySuspense,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/react",
3
- "version": "1.0.2",
3
+ "version": "1.0.6-test1",
4
4
  "description": "A set of React hooks and providers to use Liveblocks declaratively. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -20,8 +20,8 @@
20
20
  "test:watch": "jest --silent --verbose --color=always --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@liveblocks/client": "1.0.2",
24
- "@liveblocks/core": "1.0.2",
23
+ "@liveblocks/client": "1.0.6-test1",
24
+ "@liveblocks/core": "1.0.6-test1",
25
25
  "use-sync-external-store": "^1.2.0"
26
26
  },
27
27
  "peerDependencies": {