@liveblocks/react 3.15.0-thread2 → 3.15.1-rc1

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
@@ -1,24 +1,14 @@
1
- <p align="center">
2
- <a href="https://liveblocks.io#gh-light-mode-only">
3
- <img src="https://raw.githubusercontent.com/liveblocks/liveblocks/main/.github/assets/header-light.svg" alt="Liveblocks" />
4
- </a>
5
- <a href="https://liveblocks.io#gh-dark-mode-only">
6
- <img src="https://raw.githubusercontent.com/liveblocks/liveblocks/main/.github/assets/header-dark.svg" alt="Liveblocks" />
7
- </a>
1
+ <p>
2
+ <a href="https://liveblocks.io#gh-light-mode-only"><img src="https://raw.githubusercontent.com/liveblocks/liveblocks/main/.github/assets/header-light.svg" alt="Liveblocks" /></a>
3
+ <a href="https://liveblocks.io#gh-dark-mode-only"><img src="https://raw.githubusercontent.com/liveblocks/liveblocks/main/.github/assets/header-dark.svg" alt="Liveblocks" /></a>
8
4
  </p>
9
5
 
10
6
  # `@liveblocks/react`
11
7
 
12
8
  <p>
13
- <a href="https://npmjs.org/package/@liveblocks/react">
14
- <img src="https://img.shields.io/npm/v/@liveblocks/react?style=flat&label=npm&color=c33" alt="NPM" />
15
- </a>
16
- <a href="https://bundlephobia.com/package/@liveblocks/react">
17
- <img src="https://img.shields.io/bundlephobia/minzip/@liveblocks/react?style=flat&label=size&color=09f" alt="Size" />
18
- </a>
19
- <a href="https://github.com/liveblocks/liveblocks/blob/main/LICENSE">
20
- <img src="https://img.shields.io/github/license/liveblocks/liveblocks?style=flat&label=license&color=f80" alt="License" />
21
- </a>
9
+ <a href="https://npmjs.org/package/@liveblocks/react"><img src="https://img.shields.io/npm/v/@liveblocks/react?style=flat&label=npm&color=c33" alt="NPM" /></a>
10
+ <a href="https://bundlephobia.com/package/@liveblocks/react"><img src="https://img.shields.io/bundlephobia/minzip/@liveblocks/react?style=flat&label=size&color=09f" alt="Size" /></a>
11
+ <a href="https://github.com/liveblocks/liveblocks/blob/main/licenses/LICENSE-APACHE-2.0"><img src="https://img.shields.io/badge/license-Apache--2.0-green" alt="License" /></a>
22
12
  </p>
23
13
 
24
14
  `@liveblocks/react` provides [React](https://reactjs.org/) hooks and providers
package/dist/_private.cjs CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
 
27
27
 
28
- var _chunkZ3NTUAGPcjs = require('./chunk-Z3NTUAGP.cjs');
28
+ var _chunkL3D3UECFcjs = require('./chunk-L3D3UECF.cjs');
29
29
 
30
30
  // src/lib/use-layout-effect.ts
31
31
  var _react = require('react');
@@ -50,7 +50,7 @@ function selectorFor_useGroup(state) {
50
50
  };
51
51
  }
52
52
  function useGroup(groupId) {
53
- const client = _chunkZ3NTUAGPcjs.useClient.call(void 0, );
53
+ const client = _chunkL3D3UECFcjs.useClient.call(void 0, );
54
54
  const store = client[_core.kInternal].httpClient.groupsStore;
55
55
  const getGroupState = _react.useCallback.call(void 0,
56
56
  () => store.getItemState(groupId),
@@ -59,7 +59,7 @@ function useGroup(groupId) {
59
59
  _react.useEffect.call(void 0, () => {
60
60
  void store.enqueue(groupId);
61
61
  }, [store, groupId]);
62
- return _chunkZ3NTUAGPcjs.useSyncExternalStoreWithSelector.call(void 0,
62
+ return _chunkL3D3UECFcjs.useSyncExternalStoreWithSelector.call(void 0,
63
63
  store.subscribe,
64
64
  getGroupState,
65
65
  getGroupState,
@@ -80,8 +80,8 @@ function normalizeMentionSuggestions(suggestions) {
80
80
  function useMentionSuggestions(roomId, search) {
81
81
  const [mentionSuggestions, setMentionSuggestions] = _react.useState.call(void 0, );
82
82
  const lastInvokedAt = _react.useRef.call(void 0, );
83
- const resolveMentionSuggestions = _chunkZ3NTUAGPcjs.useResolveMentionSuggestions.call(void 0, );
84
- const mentionSuggestionsCache = _chunkZ3NTUAGPcjs.useMentionSuggestionsCache.call(void 0, );
83
+ const resolveMentionSuggestions = _chunkL3D3UECFcjs.useResolveMentionSuggestions.call(void 0, );
84
+ const mentionSuggestionsCache = _chunkL3D3UECFcjs.useMentionSuggestionsCache.call(void 0, );
85
85
  _react.useEffect.call(void 0, () => {
86
86
  if (search === void 0 || !resolveMentionSuggestions) {
87
87
  return;
@@ -136,7 +136,7 @@ function useMentionSuggestions(roomId, search) {
136
136
 
137
137
 
138
138
  function useSyncSource() {
139
- const client = _chunkZ3NTUAGPcjs.useClient.call(void 0, );
139
+ const client = _chunkL3D3UECFcjs.useClient.call(void 0, );
140
140
  const createSyncSource = client[_core.kInternal].createSyncSource;
141
141
  const [syncSource, setSyncSource] = _react.useState.call(void 0, );
142
142
  _react.useEffect.call(void 0, () => {
@@ -176,5 +176,5 @@ function useSyncSource() {
176
176
 
177
177
 
178
178
 
179
- exports.getUmbrellaStoreForClient = _chunkZ3NTUAGPcjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunkZ3NTUAGPcjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunkZ3NTUAGPcjs.useClientOrNull; exports.useCreateRoomComment = _chunkZ3NTUAGPcjs.useCreateRoomComment; exports.useCreateRoomThread = _chunkZ3NTUAGPcjs.useCreateRoomThread; exports.useCreateTextMention = _chunkZ3NTUAGPcjs.useCreateTextMention; exports.useDeleteRoomComment = _chunkZ3NTUAGPcjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunkZ3NTUAGPcjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunkZ3NTUAGPcjs.useDeleteTextMention; exports.useEditRoomComment = _chunkZ3NTUAGPcjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunkZ3NTUAGPcjs.useEditRoomThreadMetadata; exports.useGroup = useGroup; exports.useLatest = _chunkZ3NTUAGPcjs.useLatest; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunkZ3NTUAGPcjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunkZ3NTUAGPcjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunkZ3NTUAGPcjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunkZ3NTUAGPcjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunkZ3NTUAGPcjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunkZ3NTUAGPcjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunkZ3NTUAGPcjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunkZ3NTUAGPcjs.useRoomAttachmentUrl; exports.useRoomPermissions = _chunkZ3NTUAGPcjs.useRoomPermissions; exports.useRoomThreadSubscription = _chunkZ3NTUAGPcjs.useRoomThreadSubscription; exports.useSignal = _chunkZ3NTUAGPcjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunkZ3NTUAGPcjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunkZ3NTUAGPcjs.useYjsProvider;
179
+ exports.getUmbrellaStoreForClient = _chunkL3D3UECFcjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunkL3D3UECFcjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunkL3D3UECFcjs.useClientOrNull; exports.useCreateRoomComment = _chunkL3D3UECFcjs.useCreateRoomComment; exports.useCreateRoomThread = _chunkL3D3UECFcjs.useCreateRoomThread; exports.useCreateTextMention = _chunkL3D3UECFcjs.useCreateTextMention; exports.useDeleteRoomComment = _chunkL3D3UECFcjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunkL3D3UECFcjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunkL3D3UECFcjs.useDeleteTextMention; exports.useEditRoomComment = _chunkL3D3UECFcjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunkL3D3UECFcjs.useEditRoomThreadMetadata; exports.useGroup = useGroup; exports.useLatest = _chunkL3D3UECFcjs.useLatest; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunkL3D3UECFcjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunkL3D3UECFcjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunkL3D3UECFcjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunkL3D3UECFcjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunkL3D3UECFcjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunkL3D3UECFcjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunkL3D3UECFcjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunkL3D3UECFcjs.useRoomAttachmentUrl; exports.useRoomPermissions = _chunkL3D3UECFcjs.useRoomPermissions; exports.useRoomThreadSubscription = _chunkL3D3UECFcjs.useRoomThreadSubscription; exports.useSignal = _chunkL3D3UECFcjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunkL3D3UECFcjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunkL3D3UECFcjs.useYjsProvider;
180
180
  //# sourceMappingURL=_private.cjs.map
package/dist/_private.js CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  useSignal,
26
26
  useSyncExternalStoreWithSelector,
27
27
  useYjsProvider
28
- } from "./chunk-B5F24HAT.js";
28
+ } from "./chunk-7TVEKSIE.js";
29
29
 
30
30
  // src/lib/use-layout-effect.ts
31
31
  import { useEffect, useLayoutEffect as useOriginalLayoutEffect } from "react";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/version.ts
2
2
  var PKG_NAME = "@liveblocks/react";
3
- var PKG_VERSION = "3.15.0-thread2";
3
+ var PKG_VERSION = "3.15.1-rc1";
4
4
  var PKG_FORMAT = "cjs";
5
5
 
6
6
  // src/ClientSideSuspense.tsx
@@ -20,4 +20,4 @@ function ClientSideSuspense(props) {
20
20
 
21
21
 
22
22
  exports.PKG_NAME = PKG_NAME; exports.PKG_VERSION = PKG_VERSION; exports.PKG_FORMAT = PKG_FORMAT; exports.ClientSideSuspense = ClientSideSuspense;
23
- //# sourceMappingURL=chunk-RYUXBGU2.cjs.map
23
+ //# sourceMappingURL=chunk-4FSGM2LX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-4FSGM2LX.cjs","../src/version.ts","../src/ClientSideSuspense.tsx"],"names":[],"mappings":"AAAA;ACGO,IAAM,SAAA,EAAW,mBAAA;AACjB,IAAM,YAAA,EAAiD,YAAA;AACvD,IAAM,WAAA,EAAgD,KAAA;ADD7D;AACA;AEJA,8BAA8C;AAkC1C,+CAAA;AAVG,SAAS,kBAAA,CAAmB,KAAA,EAAc;AAC/C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,EAAA,EAAI,6BAAA,KAAc,CAAA;AAE5C,EAAA,8BAAA,CAAU,EAAA,GAAM;AAGd,IAAA,UAAA,CAAW,IAAI,CAAA;AAAA,EACjB,CAAA,EAAG,CAAC,CAAC,CAAA;AAEL,EAAA,uBACE,6BAAA,eAAC,EAAA,EAAS,QAAA,EAAU,KAAA,CAAM,QAAA,EACvB,QAAA,EAAA,QAAA,EACG,OAAO,KAAA,CAAM,SAAA,IAAa,WAAA,EACxB,KAAA,CAAM,QAAA,CAAS,EAAA,EACf,KAAA,CAAM,SAAA,EACR,KAAA,CAAM,SAAA,CACZ,CAAA;AAEJ;AF5BA;AACA;AACE;AACA;AACA;AACA;AACF,iJAAC","file":"/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-4FSGM2LX.cjs","sourcesContent":[null,"declare const __VERSION__: string;\ndeclare const TSUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof TSUP_FORMAT === \"string\" && TSUP_FORMAT;\n","import type { ReactNode } from \"react\";\nimport { Suspense, useEffect, useState } from \"react\";\n\ntype Props = {\n fallback: ReactNode;\n children: (() => ReactNode | undefined) | ReactNode | undefined;\n};\n\n/**\n * Almost like a normal <Suspense> component, except that for server-side\n * renders, the fallback will be used.\n *\n * The child props will have to be provided in a function, i.e. change:\n *\n * <Suspense fallback={<Loading />}>\n * <MyRealComponent a={1} />\n * </Suspense>\n *\n * To:\n *\n * <ClientSideSuspense fallback={<Loading />}>\n * <MyRealComponent a={1} />\n * </ClientSideSuspense>\n *\n */\nexport function ClientSideSuspense(props: Props) {\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => {\n // Effects are never executed on the server side. The point of this is to\n // delay the flipping of this boolean until after hydration has happened.\n setMounted(true);\n }, []);\n\n return (\n <Suspense fallback={props.fallback}>\n {mounted\n ? typeof props.children === \"function\"\n ? props.children()\n : props.children\n : props.fallback}\n </Suspense>\n );\n}\n"]}
@@ -559,6 +559,7 @@ var PaginatedResource = class {
559
559
  this.#patch({ isFetchingMore: true });
560
560
  try {
561
561
  const nextCursor = await this.#fetchPage(state.data.cursor);
562
+ this.#pendingFetchMore = null;
562
563
  this.#patch({
563
564
  cursor: nextCursor,
564
565
  hasFetchedAll: nextCursor === null,
@@ -566,6 +567,7 @@ var PaginatedResource = class {
566
567
  isFetchingMore: false
567
568
  });
568
569
  } catch (err) {
570
+ this.#pendingFetchMore = null;
569
571
  this.#patch({
570
572
  isFetchingMore: false,
571
573
  fetchMoreError: err
@@ -576,9 +578,7 @@ var PaginatedResource = class {
576
578
  const state = this.#signal.get();
577
579
  if (!state.data?.cursor) return noop;
578
580
  if (!this.#pendingFetchMore) {
579
- this.#pendingFetchMore = this.#fetchMore().finally(() => {
580
- this.#pendingFetchMore = null;
581
- });
581
+ this.#pendingFetchMore = this.#fetchMore();
582
582
  }
583
583
  return this.#pendingFetchMore;
584
584
  }
@@ -5744,4 +5744,4 @@ export {
5744
5744
  _useStorageRoot,
5745
5745
  _useUpdateMyPresence
5746
5746
  };
5747
- //# sourceMappingURL=chunk-B5F24HAT.js.map
5747
+ //# sourceMappingURL=chunk-7TVEKSIE.js.map