@liveblocks/react 2.17.0-usrnotsettings1 → 2.17.0-usrnotsettings2
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/_private.js +5 -5
- package/dist/_private.mjs +1 -1
- package/dist/{chunk-4F7C4HN7.js → chunk-CTSQGLA4.js} +24 -15
- package/dist/chunk-CTSQGLA4.js.map +1 -0
- package/dist/{chunk-KAFU5ZQA.mjs → chunk-D5P6PENM.mjs} +2 -2
- package/dist/{chunk-DT3BO7N5.js → chunk-QJATV7TB.js} +2 -2
- package/dist/{chunk-DT3BO7N5.js.map → chunk-QJATV7TB.js.map} +1 -1
- package/dist/{chunk-LOPNJCSB.mjs → chunk-X2FQ2FNK.mjs} +24 -15
- package/dist/chunk-X2FQ2FNK.mjs.map +1 -0
- package/dist/index.js +4 -4
- package/dist/index.mjs +2 -2
- package/dist/suspense.js +4 -4
- package/dist/suspense.mjs +2 -2
- package/package.json +3 -3
- package/dist/chunk-4F7C4HN7.js.map +0 -1
- package/dist/chunk-LOPNJCSB.mjs.map +0 -1
- /package/dist/{chunk-KAFU5ZQA.mjs.map → chunk-D5P6PENM.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
2
|
var PKG_NAME = "@liveblocks/react";
|
|
3
|
-
var PKG_VERSION = "2.17.0-
|
|
3
|
+
var PKG_VERSION = "2.17.0-usrnotsettings2";
|
|
4
4
|
var PKG_FORMAT = "esm";
|
|
5
5
|
|
|
6
6
|
// src/ClientSideSuspense.tsx
|
|
@@ -20,4 +20,4 @@ export {
|
|
|
20
20
|
PKG_FORMAT,
|
|
21
21
|
ClientSideSuspense
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-D5P6PENM.mjs.map
|
|
@@ -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 = "2.17.0-
|
|
3
|
+
var PKG_VERSION = "2.17.0-usrnotsettings2";
|
|
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-
|
|
23
|
+
//# sourceMappingURL=chunk-QJATV7TB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/chunk-QJATV7TB.js","../src/version.ts","../src/ClientSideSuspense.tsx"],"names":[],"mappings":"AAAA;ACGO,IAAM,SAAA,EAAW,mBAAA;AACjB,IAAM,YAAA,EAAiD,wBAAA;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-QJATV7TB.js","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"]}
|
|
@@ -161,6 +161,15 @@ function count(it, predicate) {
|
|
|
161
161
|
return total;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
// src/lib/ssr.ts
|
|
165
|
+
function ensureNotServerSide() {
|
|
166
|
+
if (typeof window === "undefined") {
|
|
167
|
+
throw new Error(
|
|
168
|
+
"You cannot use the Suspense version of Liveblocks hooks server side. Make sure to only call them client side by using a ClientSideSuspense wrapper.\nFor tips, see https://liveblocks.io/docs/api-reference/liveblocks-react#ClientSideSuspense"
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
164
173
|
// src/lib/use-initial.ts
|
|
165
174
|
import { useCallback, useReducer } from "react";
|
|
166
175
|
|
|
@@ -771,16 +780,16 @@ var UmbrellaStore = class {
|
|
|
771
780
|
//
|
|
772
781
|
// Mutate inputs... ...observe clean/consistent output!
|
|
773
782
|
//
|
|
774
|
-
// .-> Base ThreadDB ---------+ +----> Clean threads by ID
|
|
783
|
+
// .-> Base ThreadDB ---------+ +----> Clean threads by ID (Part 1)
|
|
775
784
|
// / | |
|
|
776
|
-
// mutate ----> Base Notifications --+ | | +--> Clean notifications
|
|
785
|
+
// mutate ----> Base Notifications --+ | | +--> Clean notifications (Part 1)
|
|
777
786
|
// \ | | | | & notifications by ID
|
|
778
787
|
// | \ | | Apply | |
|
|
779
|
-
// | `-> OptimisticUpdates --+--+--> Optimistic --+-+--> Notification Settings
|
|
788
|
+
// | `-> OptimisticUpdates --+--+--> Optimistic --+-+--> Room Notification Settings (Part 2)
|
|
780
789
|
// \ | Updates | |
|
|
781
|
-
// `------- etc etc ---------+ | +--> History Versions
|
|
790
|
+
// `------- etc etc ---------+ | +--> History Versions (Part 3)
|
|
782
791
|
// ^ |
|
|
783
|
-
// | +----->
|
|
792
|
+
// | +-----> User Notification Settings (Part 4)
|
|
784
793
|
// |
|
|
785
794
|
// |
|
|
786
795
|
// | ^ ^
|
|
@@ -840,7 +849,7 @@ var UmbrellaStore = class {
|
|
|
840
849
|
return nextCursor;
|
|
841
850
|
}
|
|
842
851
|
);
|
|
843
|
-
const
|
|
852
|
+
const userNotificationSettingsFetcher = async () => {
|
|
844
853
|
const result = await this.#client.getNotificationSettings();
|
|
845
854
|
this.userNotificationSettings.update(result);
|
|
846
855
|
};
|
|
@@ -848,7 +857,7 @@ var UmbrellaStore = class {
|
|
|
848
857
|
this.optimisticUpdates.signal
|
|
849
858
|
);
|
|
850
859
|
this.#userNotificationSettings = new SinglePageResource(
|
|
851
|
-
|
|
860
|
+
userNotificationSettingsFetcher
|
|
852
861
|
);
|
|
853
862
|
this.threads = new ThreadDB();
|
|
854
863
|
this.notifications = createStore_forNotifications();
|
|
@@ -1897,6 +1906,7 @@ function useInboxNotifications_withClient(client, selector, isEqual) {
|
|
|
1897
1906
|
);
|
|
1898
1907
|
}
|
|
1899
1908
|
function useInboxNotificationsSuspense_withClient(client) {
|
|
1909
|
+
ensureNotServerSide();
|
|
1900
1910
|
const store = getLiveblocksExtrasForClient(client).store;
|
|
1901
1911
|
use(store.outputs.loadingNotifications.waitUntilLoaded());
|
|
1902
1912
|
const result = useInboxNotifications_withClient(client, identity2, shallow4);
|
|
@@ -1912,6 +1922,7 @@ function useUnreadInboxNotificationsCount_withClient(client) {
|
|
|
1912
1922
|
);
|
|
1913
1923
|
}
|
|
1914
1924
|
function useUnreadInboxNotificationsCountSuspense_withClient(client) {
|
|
1925
|
+
ensureNotServerSide();
|
|
1915
1926
|
const store = getLiveblocksExtrasForClient(client).store;
|
|
1916
1927
|
use(store.outputs.loadingNotifications.waitUntilLoaded());
|
|
1917
1928
|
const result = useUnreadInboxNotificationsCount_withClient(client);
|
|
@@ -2088,6 +2099,7 @@ function useNotificationSettings_withClient(client) {
|
|
|
2088
2099
|
}, [settings, updateNotificationSettings]);
|
|
2089
2100
|
}
|
|
2090
2101
|
function useNotificationSettingsSuspense_withClient(client) {
|
|
2102
|
+
ensureNotServerSide();
|
|
2091
2103
|
const store = getLiveblocksExtrasForClient(client).store;
|
|
2092
2104
|
use(store.outputs.userNotificationSettings.waitUntilLoaded());
|
|
2093
2105
|
const [settings, updateNotificationSettings] = useNotificationSettings_withClient(client);
|
|
@@ -2321,6 +2333,7 @@ function useUserThreads_experimental(options = {}) {
|
|
|
2321
2333
|
);
|
|
2322
2334
|
}
|
|
2323
2335
|
function useUserThreadsSuspense_experimental(options = {}) {
|
|
2336
|
+
ensureNotServerSide();
|
|
2324
2337
|
const client = useClient();
|
|
2325
2338
|
const { store } = getLiveblocksExtrasForClient(client);
|
|
2326
2339
|
const queryKey = makeUserThreadsQueryKey(options.query);
|
|
@@ -3724,6 +3737,7 @@ function useRoomNotificationSettings() {
|
|
|
3724
3737
|
}, [settings, updateRoomNotificationSettings]);
|
|
3725
3738
|
}
|
|
3726
3739
|
function useRoomNotificationSettingsSuspense() {
|
|
3740
|
+
ensureNotServerSide();
|
|
3727
3741
|
const client = useClient();
|
|
3728
3742
|
const store = getRoomExtrasForClient(client).store;
|
|
3729
3743
|
const room = useRoom();
|
|
@@ -3788,6 +3802,7 @@ function useHistoryVersions() {
|
|
|
3788
3802
|
return useSignal(store.outputs.versionsByRoomId.getOrCreate(room.id).signal);
|
|
3789
3803
|
}
|
|
3790
3804
|
function useHistoryVersionsSuspense() {
|
|
3805
|
+
ensureNotServerSide();
|
|
3791
3806
|
const client = useClient();
|
|
3792
3807
|
const room = useRoom();
|
|
3793
3808
|
const store = getRoomExtrasForClient(client).store;
|
|
@@ -3822,13 +3837,6 @@ function useUpdateRoomNotificationSettings() {
|
|
|
3822
3837
|
[client, room]
|
|
3823
3838
|
);
|
|
3824
3839
|
}
|
|
3825
|
-
function ensureNotServerSide() {
|
|
3826
|
-
if (typeof window === "undefined") {
|
|
3827
|
-
throw new Error(
|
|
3828
|
-
"You cannot use the Suspense version of this hook on the server side. Make sure to only call them on the client side.\nFor tips, see https://liveblocks.io/docs/api-reference/liveblocks-react#suspense-avoid-ssr"
|
|
3829
|
-
);
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
3840
|
function useSuspendUntilPresenceReady() {
|
|
3833
3841
|
ensureNotServerSide();
|
|
3834
3842
|
const room = useRoom();
|
|
@@ -3877,6 +3885,7 @@ function useStorageStatusSuspense(options) {
|
|
|
3877
3885
|
return useStorageStatus(options);
|
|
3878
3886
|
}
|
|
3879
3887
|
function useThreadsSuspense(options = {}) {
|
|
3888
|
+
ensureNotServerSide();
|
|
3880
3889
|
const client = useClient();
|
|
3881
3890
|
const room = useRoom();
|
|
3882
3891
|
const { store } = getRoomExtrasForClient(client);
|
|
@@ -4107,4 +4116,4 @@ export {
|
|
|
4107
4116
|
_useStorageRoot,
|
|
4108
4117
|
_useUpdateMyPresence
|
|
4109
4118
|
};
|
|
4110
|
-
//# sourceMappingURL=chunk-
|
|
4119
|
+
//# sourceMappingURL=chunk-X2FQ2FNK.mjs.map
|