@liveblocks/react 2.15.2 → 2.16.0-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/dist/_private.d.mts +4 -4
- package/dist/_private.d.ts +4 -4
- package/dist/_private.js +5 -7
- package/dist/_private.js.map +1 -1
- package/dist/_private.mjs +1 -3
- package/dist/_private.mjs.map +1 -1
- package/dist/{chunk-3KHBALYA.js → chunk-IFSN2WSB.js} +2 -2
- package/dist/chunk-IFSN2WSB.js.map +1 -0
- package/dist/{chunk-EEYUKRIA.mjs → chunk-JZBPCFEX.mjs} +110 -242
- package/dist/chunk-JZBPCFEX.mjs.map +1 -0
- package/dist/{chunk-DEAPV4GE.js → chunk-NZL5WL5O.js} +113 -245
- package/dist/chunk-NZL5WL5O.js.map +1 -0
- package/dist/{chunk-Z5VZOX7K.mjs → chunk-SIZA7M3F.mjs} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{room-0rxzsE_0.d.mts → room-Ce3twcjb.d.mts} +127 -252
- package/dist/{room-0rxzsE_0.d.ts → room-Ce3twcjb.d.ts} +127 -252
- package/dist/suspense.d.mts +1 -1
- package/dist/suspense.d.ts +1 -1
- package/dist/suspense.js +4 -4
- package/dist/suspense.js.map +1 -1
- package/dist/suspense.mjs +2 -2
- package/dist/suspense.mjs.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-3KHBALYA.js.map +0 -1
- package/dist/chunk-DEAPV4GE.js.map +0 -1
- package/dist/chunk-EEYUKRIA.mjs.map +0 -1
- /package/dist/{chunk-Z5VZOX7K.mjs.map → chunk-SIZA7M3F.mjs.map} +0 -0
|
@@ -224,15 +224,13 @@ import {
|
|
|
224
224
|
console as console2,
|
|
225
225
|
DefaultMap,
|
|
226
226
|
DerivedSignal,
|
|
227
|
-
HttpError,
|
|
228
227
|
kInternal,
|
|
229
228
|
MutableSignal as MutableSignal2,
|
|
230
229
|
nanoid,
|
|
231
230
|
nn,
|
|
232
231
|
shallow as shallow3,
|
|
233
232
|
Signal,
|
|
234
|
-
stringify
|
|
235
|
-
unstringify
|
|
233
|
+
stringify
|
|
236
234
|
} from "@liveblocks/core";
|
|
237
235
|
|
|
238
236
|
// src/lib/autobind.ts
|
|
@@ -270,16 +268,8 @@ function shallow2(a, b) {
|
|
|
270
268
|
// src/ThreadDB.ts
|
|
271
269
|
import { batch, MutableSignal, SortedList } from "@liveblocks/core";
|
|
272
270
|
|
|
273
|
-
// src/lib/guards.ts
|
|
274
|
-
import { isPlainObject as isPlainObject2 } from "@liveblocks/core";
|
|
275
|
-
function isStartsWith(blob) {
|
|
276
|
-
return isPlainObject2(blob) && isString(blob.startsWith);
|
|
277
|
-
}
|
|
278
|
-
function isString(value) {
|
|
279
|
-
return typeof value === "string";
|
|
280
|
-
}
|
|
281
|
-
|
|
282
271
|
// src/lib/querying.ts
|
|
272
|
+
import { isStartsWithOperator } from "@liveblocks/core";
|
|
283
273
|
function makeThreadsFilter(query) {
|
|
284
274
|
return (thread) => matchesQuery(thread, query) && matchesMetadata(thread, query);
|
|
285
275
|
}
|
|
@@ -290,17 +280,17 @@ function matchesMetadata(thread, q) {
|
|
|
290
280
|
const metadata = thread.metadata;
|
|
291
281
|
return q.metadata === void 0 || Object.entries(q.metadata).every(
|
|
292
282
|
([key, op]) => (
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
|
|
296
|
-
// https://liveblocks.slack.com/archives/C02PZL7QAAW/p1728546988505989
|
|
297
|
-
matchesOperator(metadata[key], op)
|
|
283
|
+
// Ignore explicit-undefined filters
|
|
284
|
+
// Boolean logic: op? => value matches the operator
|
|
285
|
+
op === void 0 || matchesOperator(metadata[key], op)
|
|
298
286
|
)
|
|
299
287
|
);
|
|
300
288
|
}
|
|
301
289
|
function matchesOperator(value, op) {
|
|
302
|
-
if (
|
|
303
|
-
return
|
|
290
|
+
if (op === null) {
|
|
291
|
+
return value === void 0;
|
|
292
|
+
} else if (isStartsWithOperator(op)) {
|
|
293
|
+
return typeof value === "string" && value.startsWith(op.startsWith);
|
|
304
294
|
} else {
|
|
305
295
|
return value === op;
|
|
306
296
|
}
|
|
@@ -844,7 +834,7 @@ var UmbrellaStore = class {
|
|
|
844
834
|
);
|
|
845
835
|
const loadingUserThreads = new DefaultMap(
|
|
846
836
|
(queryKey) => {
|
|
847
|
-
const query =
|
|
837
|
+
const query = JSON.parse(queryKey);
|
|
848
838
|
const resource = new PaginatedResource(async (cursor) => {
|
|
849
839
|
const result = await this.#client[kInternal].httpClient.getUserThreads_experimental({
|
|
850
840
|
cursor,
|
|
@@ -886,7 +876,7 @@ var UmbrellaStore = class {
|
|
|
886
876
|
);
|
|
887
877
|
const loadingRoomThreads = new DefaultMap(
|
|
888
878
|
(queryKey) => {
|
|
889
|
-
const [roomId, query] =
|
|
879
|
+
const [roomId, query] = JSON.parse(queryKey);
|
|
890
880
|
const resource = new PaginatedResource(async (cursor) => {
|
|
891
881
|
const result = await this.#client[kInternal].httpClient.getThreads({
|
|
892
882
|
roomId,
|
|
@@ -928,7 +918,8 @@ var UmbrellaStore = class {
|
|
|
928
918
|
);
|
|
929
919
|
const loadingNotifications = {
|
|
930
920
|
signal: DerivedSignal.from(() => {
|
|
931
|
-
const
|
|
921
|
+
const resource = this.#notificationsPaginationState;
|
|
922
|
+
const result = resource.get();
|
|
932
923
|
if (result.isLoading || result.error) {
|
|
933
924
|
return result;
|
|
934
925
|
}
|
|
@@ -948,10 +939,7 @@ var UmbrellaStore = class {
|
|
|
948
939
|
const resource = new SinglePageResource(async () => {
|
|
949
940
|
const room = this.#client.getRoom(roomId);
|
|
950
941
|
if (room === null) {
|
|
951
|
-
throw new
|
|
952
|
-
`Room '${roomId}' is not available on client`,
|
|
953
|
-
479
|
|
954
|
-
);
|
|
942
|
+
throw new Error(`Room '${roomId}' is not available on client`);
|
|
955
943
|
}
|
|
956
944
|
const result = await room.getNotificationSettings();
|
|
957
945
|
this.roomNotificationSettings.update(roomId, result);
|
|
@@ -974,10 +962,7 @@ var UmbrellaStore = class {
|
|
|
974
962
|
const resource = new SinglePageResource(async () => {
|
|
975
963
|
const room = this.#client.getRoom(roomId);
|
|
976
964
|
if (room === null) {
|
|
977
|
-
throw new
|
|
978
|
-
`Room '${roomId}' is not available on client`,
|
|
979
|
-
479
|
|
980
|
-
);
|
|
965
|
+
throw new Error(`Room '${roomId}' is not available on client`);
|
|
981
966
|
}
|
|
982
967
|
const result = await room[kInternal].listTextVersions();
|
|
983
968
|
this.historyVersions.update(roomId, result.versions);
|
|
@@ -994,12 +979,10 @@ var UmbrellaStore = class {
|
|
|
994
979
|
if (result.isLoading || result.error) {
|
|
995
980
|
return result;
|
|
996
981
|
} else {
|
|
997
|
-
return
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
)
|
|
1002
|
-
};
|
|
982
|
+
return ASYNC_OK(
|
|
983
|
+
"versions",
|
|
984
|
+
Object.values(this.historyVersions.signal.get()[roomId] ?? {})
|
|
985
|
+
);
|
|
1003
986
|
}
|
|
1004
987
|
}, shallow3);
|
|
1005
988
|
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
@@ -1835,8 +1818,15 @@ function useMarkInboxNotificationAsRead_withClient(client) {
|
|
|
1835
1818
|
optimisticId
|
|
1836
1819
|
);
|
|
1837
1820
|
},
|
|
1838
|
-
() => {
|
|
1821
|
+
(err) => {
|
|
1839
1822
|
store.optimisticUpdates.remove(optimisticId);
|
|
1823
|
+
client[kInternal2].emitError(
|
|
1824
|
+
{
|
|
1825
|
+
type: "MARK_INBOX_NOTIFICATION_AS_READ_ERROR",
|
|
1826
|
+
inboxNotificationId
|
|
1827
|
+
},
|
|
1828
|
+
err
|
|
1829
|
+
);
|
|
1840
1830
|
}
|
|
1841
1831
|
);
|
|
1842
1832
|
},
|
|
@@ -1855,8 +1845,13 @@ function useMarkAllInboxNotificationsAsRead_withClient(client) {
|
|
|
1855
1845
|
() => {
|
|
1856
1846
|
store.markAllInboxNotificationsRead(optimisticId, readAt);
|
|
1857
1847
|
},
|
|
1858
|
-
() => {
|
|
1848
|
+
(err) => {
|
|
1859
1849
|
store.optimisticUpdates.remove(optimisticId);
|
|
1850
|
+
client[kInternal2].emitError(
|
|
1851
|
+
// No roomId, threadId, commentId to include for this error
|
|
1852
|
+
{ type: "MARK_ALL_INBOX_NOTIFICATIONS_AS_READ_ERROR" },
|
|
1853
|
+
err
|
|
1854
|
+
);
|
|
1860
1855
|
}
|
|
1861
1856
|
);
|
|
1862
1857
|
}, [client]);
|
|
@@ -1875,8 +1870,12 @@ function useDeleteInboxNotification_withClient(client) {
|
|
|
1875
1870
|
() => {
|
|
1876
1871
|
store.deleteInboxNotification(inboxNotificationId, optimisticId);
|
|
1877
1872
|
},
|
|
1878
|
-
() => {
|
|
1873
|
+
(err) => {
|
|
1879
1874
|
store.optimisticUpdates.remove(optimisticId);
|
|
1875
|
+
client[kInternal2].emitError(
|
|
1876
|
+
{ type: "DELETE_INBOX_NOTIFICATION_ERROR", inboxNotificationId },
|
|
1877
|
+
err
|
|
1878
|
+
);
|
|
1880
1879
|
}
|
|
1881
1880
|
);
|
|
1882
1881
|
},
|
|
@@ -1895,8 +1894,12 @@ function useDeleteAllInboxNotifications_withClient(client) {
|
|
|
1895
1894
|
() => {
|
|
1896
1895
|
store.deleteAllInboxNotifications(optimisticId);
|
|
1897
1896
|
},
|
|
1898
|
-
() => {
|
|
1897
|
+
(err) => {
|
|
1899
1898
|
store.optimisticUpdates.remove(optimisticId);
|
|
1899
|
+
client[kInternal2].emitError(
|
|
1900
|
+
{ type: "DELETE_ALL_INBOX_NOTIFICATIONS_ERROR" },
|
|
1901
|
+
err
|
|
1902
|
+
);
|
|
1900
1903
|
}
|
|
1901
1904
|
);
|
|
1902
1905
|
}, [client]);
|
|
@@ -2058,6 +2061,7 @@ function createSharedContext(client) {
|
|
|
2058
2061
|
useUser: (userId) => useUser_withClient(client, userId),
|
|
2059
2062
|
useRoomInfo: (roomId) => useRoomInfo_withClient(client, roomId),
|
|
2060
2063
|
useIsInsideRoom,
|
|
2064
|
+
useErrorListener,
|
|
2061
2065
|
useSyncStatus: useSyncStatus2
|
|
2062
2066
|
},
|
|
2063
2067
|
suspense: {
|
|
@@ -2065,6 +2069,7 @@ function createSharedContext(client) {
|
|
|
2065
2069
|
useUser: (userId) => useUserSuspense_withClient(client, userId),
|
|
2066
2070
|
useRoomInfo: (roomId) => useRoomInfoSuspense_withClient(client, roomId),
|
|
2067
2071
|
useIsInsideRoom,
|
|
2072
|
+
useErrorListener,
|
|
2068
2073
|
useSyncStatus: useSyncStatus2
|
|
2069
2074
|
}
|
|
2070
2075
|
};
|
|
@@ -2119,11 +2124,7 @@ function LiveblocksProvider(props) {
|
|
|
2119
2124
|
function createLiveblocksContext(client) {
|
|
2120
2125
|
return getOrCreateContextBundle(client);
|
|
2121
2126
|
}
|
|
2122
|
-
function useUserThreads_experimental(options = {
|
|
2123
|
-
query: {
|
|
2124
|
-
metadata: {}
|
|
2125
|
-
}
|
|
2126
|
-
}) {
|
|
2127
|
+
function useUserThreads_experimental(options = {}) {
|
|
2127
2128
|
const client = useClient();
|
|
2128
2129
|
const { store, userThreadsPoller: poller } = getLiveblocksExtrasForClient(client);
|
|
2129
2130
|
const queryKey = makeUserThreadsQueryKey(options.query);
|
|
@@ -2149,11 +2150,7 @@ function useUserThreads_experimental(options = {
|
|
|
2149
2150
|
store.outputs.loadingUserThreads.getOrCreate(queryKey).signal
|
|
2150
2151
|
);
|
|
2151
2152
|
}
|
|
2152
|
-
function useUserThreadsSuspense_experimental(options = {
|
|
2153
|
-
query: {
|
|
2154
|
-
metadata: {}
|
|
2155
|
-
}
|
|
2156
|
-
}) {
|
|
2153
|
+
function useUserThreadsSuspense_experimental(options = {}) {
|
|
2157
2154
|
const client = useClient();
|
|
2158
2155
|
const { store } = getLiveblocksExtrasForClient(client);
|
|
2159
2156
|
const queryKey = makeUserThreadsQueryKey(options.query);
|
|
@@ -2252,104 +2249,14 @@ function useSyncStatusSmooth_withClient(client) {
|
|
|
2252
2249
|
function useSyncStatus(options) {
|
|
2253
2250
|
return useSyncStatus_withClient(useClient(), options);
|
|
2254
2251
|
}
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
}
|
|
2264
|
-
};
|
|
2265
|
-
var DeleteThreadError = class extends Error {
|
|
2266
|
-
constructor(cause, context) {
|
|
2267
|
-
super("Delete thread failed.");
|
|
2268
|
-
this.cause = cause;
|
|
2269
|
-
this.context = context;
|
|
2270
|
-
this.name = "DeleteThreadError";
|
|
2271
|
-
}
|
|
2272
|
-
};
|
|
2273
|
-
var EditThreadMetadataError = class extends Error {
|
|
2274
|
-
constructor(cause, context) {
|
|
2275
|
-
super("Edit thread metadata failed.");
|
|
2276
|
-
this.cause = cause;
|
|
2277
|
-
this.context = context;
|
|
2278
|
-
this.name = "EditThreadMetadataError";
|
|
2279
|
-
}
|
|
2280
|
-
};
|
|
2281
|
-
var MarkThreadAsResolvedError = class extends Error {
|
|
2282
|
-
constructor(cause, context) {
|
|
2283
|
-
super("Mark thread as resolved failed.");
|
|
2284
|
-
this.cause = cause;
|
|
2285
|
-
this.context = context;
|
|
2286
|
-
this.name = "MarkThreadAsResolvedError";
|
|
2287
|
-
}
|
|
2288
|
-
};
|
|
2289
|
-
var MarkThreadAsUnresolvedError = class extends Error {
|
|
2290
|
-
constructor(cause, context) {
|
|
2291
|
-
super("Mark thread as unresolved failed.");
|
|
2292
|
-
this.cause = cause;
|
|
2293
|
-
this.context = context;
|
|
2294
|
-
this.name = "MarkThreadAsUnresolvedError";
|
|
2295
|
-
}
|
|
2296
|
-
};
|
|
2297
|
-
var CreateCommentError = class extends Error {
|
|
2298
|
-
constructor(cause, context) {
|
|
2299
|
-
super("Create comment failed.");
|
|
2300
|
-
this.cause = cause;
|
|
2301
|
-
this.context = context;
|
|
2302
|
-
this.name = "CreateCommentError";
|
|
2303
|
-
}
|
|
2304
|
-
};
|
|
2305
|
-
var EditCommentError = class extends Error {
|
|
2306
|
-
constructor(cause, context) {
|
|
2307
|
-
super("Edit comment failed.");
|
|
2308
|
-
this.cause = cause;
|
|
2309
|
-
this.context = context;
|
|
2310
|
-
this.name = "EditCommentError";
|
|
2311
|
-
}
|
|
2312
|
-
};
|
|
2313
|
-
var DeleteCommentError = class extends Error {
|
|
2314
|
-
constructor(cause, context) {
|
|
2315
|
-
super("Delete comment failed.");
|
|
2316
|
-
this.cause = cause;
|
|
2317
|
-
this.context = context;
|
|
2318
|
-
this.name = "DeleteCommentError";
|
|
2319
|
-
}
|
|
2320
|
-
};
|
|
2321
|
-
var AddReactionError = class extends Error {
|
|
2322
|
-
constructor(cause, context) {
|
|
2323
|
-
super("Add reaction failed.");
|
|
2324
|
-
this.cause = cause;
|
|
2325
|
-
this.context = context;
|
|
2326
|
-
this.name = "AddReactionError";
|
|
2327
|
-
}
|
|
2328
|
-
};
|
|
2329
|
-
var RemoveReactionError = class extends Error {
|
|
2330
|
-
constructor(cause, context) {
|
|
2331
|
-
super("Remove reaction failed.");
|
|
2332
|
-
this.cause = cause;
|
|
2333
|
-
this.context = context;
|
|
2334
|
-
this.name = "RemoveReactionError";
|
|
2335
|
-
}
|
|
2336
|
-
};
|
|
2337
|
-
var MarkInboxNotificationAsReadError = class extends Error {
|
|
2338
|
-
constructor(cause, context) {
|
|
2339
|
-
super("Mark inbox notification as read failed.");
|
|
2340
|
-
this.cause = cause;
|
|
2341
|
-
this.context = context;
|
|
2342
|
-
this.name = "MarkInboxNotificationAsReadError";
|
|
2343
|
-
}
|
|
2344
|
-
};
|
|
2345
|
-
var UpdateNotificationSettingsError = class extends Error {
|
|
2346
|
-
constructor(cause, context) {
|
|
2347
|
-
super("Update notification settings failed.");
|
|
2348
|
-
this.cause = cause;
|
|
2349
|
-
this.context = context;
|
|
2350
|
-
this.name = "UpdateNotificationSettingsError";
|
|
2351
|
-
}
|
|
2352
|
-
};
|
|
2252
|
+
function useErrorListener(callback) {
|
|
2253
|
+
const client = useClient();
|
|
2254
|
+
const savedCallback = useLatest(callback);
|
|
2255
|
+
useEffect3(
|
|
2256
|
+
() => client.events.error.subscribe((e) => savedCallback.current(e)),
|
|
2257
|
+
[client, savedCallback]
|
|
2258
|
+
);
|
|
2259
|
+
}
|
|
2353
2260
|
|
|
2354
2261
|
// src/room.tsx
|
|
2355
2262
|
import { shallow as shallow5 } from "@liveblocks/client";
|
|
@@ -2360,9 +2267,8 @@ import {
|
|
|
2360
2267
|
createThreadId,
|
|
2361
2268
|
DefaultMap as DefaultMap2,
|
|
2362
2269
|
errorIf,
|
|
2363
|
-
HttpError
|
|
2270
|
+
HttpError,
|
|
2364
2271
|
kInternal as kInternal3,
|
|
2365
|
-
makeEventSource,
|
|
2366
2272
|
makePoller as makePoller2,
|
|
2367
2273
|
ServerMsgCode
|
|
2368
2274
|
} from "@liveblocks/core";
|
|
@@ -2456,14 +2362,6 @@ function getCurrentUserId(client) {
|
|
|
2456
2362
|
}
|
|
2457
2363
|
return userId;
|
|
2458
2364
|
}
|
|
2459
|
-
function handleApiError(err) {
|
|
2460
|
-
const message = `Request failed with status ${err.status}: ${err.message}`;
|
|
2461
|
-
if (err.details?.error === "FORBIDDEN") {
|
|
2462
|
-
const detailedMessage = [message, err.details.suggestion, err.details.docs].filter(Boolean).join("\n");
|
|
2463
|
-
console3.error(detailedMessage);
|
|
2464
|
-
}
|
|
2465
|
-
return new Error(message);
|
|
2466
|
-
}
|
|
2467
2365
|
var _extras2 = /* @__PURE__ */ new WeakMap();
|
|
2468
2366
|
var _bundles2 = /* @__PURE__ */ new WeakMap();
|
|
2469
2367
|
function getOrCreateRoomContextBundle(client) {
|
|
@@ -2484,19 +2382,21 @@ function getRoomExtrasForClient(client) {
|
|
|
2484
2382
|
}
|
|
2485
2383
|
function makeRoomExtrasForClient(client) {
|
|
2486
2384
|
const store = getUmbrellaStoreForClient(client);
|
|
2487
|
-
|
|
2488
|
-
function onMutationFailure(innerError, optimisticId, createPublicError) {
|
|
2385
|
+
function onMutationFailure(optimisticId, context, innerError) {
|
|
2489
2386
|
store.optimisticUpdates.remove(optimisticId);
|
|
2490
|
-
if (innerError instanceof
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2387
|
+
if (innerError instanceof HttpError) {
|
|
2388
|
+
if (innerError.status === 403) {
|
|
2389
|
+
const detailedMessage = [
|
|
2390
|
+
innerError.message,
|
|
2391
|
+
innerError.details?.suggestion,
|
|
2392
|
+
innerError.details?.docs
|
|
2393
|
+
].filter(Boolean).join("\n");
|
|
2394
|
+
console3.error(detailedMessage);
|
|
2395
|
+
}
|
|
2396
|
+
client[kInternal3].emitError(context, innerError);
|
|
2397
|
+
} else {
|
|
2398
|
+
throw innerError;
|
|
2498
2399
|
}
|
|
2499
|
-
throw innerError;
|
|
2500
2400
|
}
|
|
2501
2401
|
const threadsPollersByRoomId = new DefaultMap2(
|
|
2502
2402
|
(roomId) => makePoller2(
|
|
@@ -2542,7 +2442,6 @@ function makeRoomExtrasForClient(client) {
|
|
|
2542
2442
|
);
|
|
2543
2443
|
return {
|
|
2544
2444
|
store,
|
|
2545
|
-
commentsErrorEventSource: commentsErrorEventSource.observable,
|
|
2546
2445
|
onMutationFailure,
|
|
2547
2446
|
getOrCreateThreadsPollerForRoomId: threadsPollersByRoomId.getOrCreate.bind(
|
|
2548
2447
|
threadsPollersByRoomId
|
|
@@ -2568,7 +2467,6 @@ function makeRoomContextBundle(client) {
|
|
|
2568
2467
|
useBroadcastEvent,
|
|
2569
2468
|
useOthersListener,
|
|
2570
2469
|
useLostConnectionListener,
|
|
2571
|
-
useErrorListener,
|
|
2572
2470
|
useEventListener,
|
|
2573
2471
|
useHistory,
|
|
2574
2472
|
useUndo,
|
|
@@ -2614,7 +2512,6 @@ function makeRoomContextBundle(client) {
|
|
|
2614
2512
|
useBroadcastEvent,
|
|
2615
2513
|
useOthersListener,
|
|
2616
2514
|
useLostConnectionListener,
|
|
2617
|
-
useErrorListener,
|
|
2618
2515
|
useEventListener,
|
|
2619
2516
|
useHistory,
|
|
2620
2517
|
useUndo,
|
|
@@ -2650,8 +2547,7 @@ function makeRoomContextBundle(client) {
|
|
|
2650
2547
|
useRoomNotificationSettings: useRoomNotificationSettingsSuspense,
|
|
2651
2548
|
useUpdateRoomNotificationSettings,
|
|
2652
2549
|
...shared.suspense
|
|
2653
|
-
}
|
|
2654
|
-
useCommentsErrorListener
|
|
2550
|
+
}
|
|
2655
2551
|
};
|
|
2656
2552
|
return Object.defineProperty(bundle, kInternal3, {
|
|
2657
2553
|
enumerable: false
|
|
@@ -2694,7 +2590,7 @@ function RoomProviderInner(props) {
|
|
|
2694
2590
|
"RoomProvider id property is required. For more information: https://liveblocks.io/docs/errors/liveblocks-react/RoomProvider-id-property-is-required"
|
|
2695
2591
|
);
|
|
2696
2592
|
}
|
|
2697
|
-
if (
|
|
2593
|
+
if (typeof roomId !== "string") {
|
|
2698
2594
|
throw new Error("RoomProvider id property should be a string.");
|
|
2699
2595
|
}
|
|
2700
2596
|
const majorReactVersion = parseInt(reactVersion) || 1;
|
|
@@ -2912,14 +2808,6 @@ function useLostConnectionListener(callback) {
|
|
|
2912
2808
|
[room, savedCallback]
|
|
2913
2809
|
);
|
|
2914
2810
|
}
|
|
2915
|
-
function useErrorListener(callback) {
|
|
2916
|
-
const room = useRoom();
|
|
2917
|
-
const savedCallback = useLatest(callback);
|
|
2918
|
-
useEffect5(
|
|
2919
|
-
() => room.events.error.subscribe((e) => savedCallback.current(e)),
|
|
2920
|
-
[room, savedCallback]
|
|
2921
|
-
);
|
|
2922
|
-
}
|
|
2923
2811
|
function useEventListener(callback) {
|
|
2924
2812
|
const room = useRoom();
|
|
2925
2813
|
const savedCallback = useLatest(callback);
|
|
@@ -3129,14 +3017,6 @@ function useThreads(options = {}) {
|
|
|
3129
3017
|
useScrollToCommentOnLoadEffect(scrollOnLoad, result);
|
|
3130
3018
|
return result;
|
|
3131
3019
|
}
|
|
3132
|
-
function useCommentsErrorListener(callback) {
|
|
3133
|
-
const client = useClient();
|
|
3134
|
-
const savedCallback = useLatest(callback);
|
|
3135
|
-
const { commentsErrorEventSource } = getRoomExtrasForClient(client);
|
|
3136
|
-
useEffect5(() => {
|
|
3137
|
-
return commentsErrorEventSource.subscribe(savedCallback.current);
|
|
3138
|
-
}, [savedCallback, commentsErrorEventSource]);
|
|
3139
|
-
}
|
|
3140
3020
|
function useCreateThread() {
|
|
3141
3021
|
return useCreateRoomThread(useRoom().id);
|
|
3142
3022
|
}
|
|
@@ -3190,15 +3070,16 @@ function useCreateRoomThread(roomId) {
|
|
|
3190
3070
|
store.createThread(optimisticId, thread);
|
|
3191
3071
|
},
|
|
3192
3072
|
(err) => onMutationFailure(
|
|
3193
|
-
err,
|
|
3194
3073
|
optimisticId,
|
|
3195
|
-
|
|
3074
|
+
{
|
|
3075
|
+
type: "CREATE_THREAD_ERROR",
|
|
3196
3076
|
roomId,
|
|
3197
3077
|
threadId,
|
|
3198
3078
|
commentId,
|
|
3199
3079
|
body,
|
|
3200
3080
|
metadata
|
|
3201
|
-
}
|
|
3081
|
+
},
|
|
3082
|
+
err
|
|
3202
3083
|
)
|
|
3203
3084
|
);
|
|
3204
3085
|
return newThread;
|
|
@@ -3230,9 +3111,9 @@ function useDeleteRoomThread(roomId) {
|
|
|
3230
3111
|
store.deleteThread(threadId, optimisticId);
|
|
3231
3112
|
},
|
|
3232
3113
|
(err) => onMutationFailure(
|
|
3233
|
-
err,
|
|
3234
3114
|
optimisticId,
|
|
3235
|
-
|
|
3115
|
+
{ type: "DELETE_THREAD_ERROR", roomId, threadId },
|
|
3116
|
+
err
|
|
3236
3117
|
)
|
|
3237
3118
|
);
|
|
3238
3119
|
},
|
|
@@ -3265,13 +3146,14 @@ function useEditRoomThreadMetadata(roomId) {
|
|
|
3265
3146
|
store.patchThread(threadId, optimisticId, { metadata: metadata2 }, updatedAt)
|
|
3266
3147
|
),
|
|
3267
3148
|
(err) => onMutationFailure(
|
|
3268
|
-
err,
|
|
3269
3149
|
optimisticId,
|
|
3270
|
-
|
|
3150
|
+
{
|
|
3151
|
+
type: "EDIT_THREAD_METADATA_ERROR",
|
|
3271
3152
|
roomId,
|
|
3272
3153
|
threadId,
|
|
3273
3154
|
metadata
|
|
3274
|
-
}
|
|
3155
|
+
},
|
|
3156
|
+
err
|
|
3275
3157
|
)
|
|
3276
3158
|
);
|
|
3277
3159
|
},
|
|
@@ -3309,14 +3191,15 @@ function useCreateRoomComment(roomId) {
|
|
|
3309
3191
|
store.createComment(newComment, optimisticId);
|
|
3310
3192
|
},
|
|
3311
3193
|
(err) => onMutationFailure(
|
|
3312
|
-
err,
|
|
3313
3194
|
optimisticId,
|
|
3314
|
-
|
|
3195
|
+
{
|
|
3196
|
+
type: "CREATE_COMMENT_ERROR",
|
|
3315
3197
|
roomId,
|
|
3316
3198
|
threadId,
|
|
3317
3199
|
commentId,
|
|
3318
3200
|
body
|
|
3319
|
-
}
|
|
3201
|
+
},
|
|
3202
|
+
err
|
|
3320
3203
|
)
|
|
3321
3204
|
);
|
|
3322
3205
|
return comment;
|
|
@@ -3364,14 +3247,9 @@ function useEditRoomComment(roomId) {
|
|
|
3364
3247
|
store.editComment(threadId, optimisticId, editedComment);
|
|
3365
3248
|
},
|
|
3366
3249
|
(err) => onMutationFailure(
|
|
3367
|
-
err,
|
|
3368
3250
|
optimisticId,
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
threadId,
|
|
3372
|
-
commentId,
|
|
3373
|
-
body
|
|
3374
|
-
})
|
|
3251
|
+
{ type: "EDIT_COMMENT_ERROR", roomId, threadId, commentId, body },
|
|
3252
|
+
err
|
|
3375
3253
|
)
|
|
3376
3254
|
);
|
|
3377
3255
|
},
|
|
@@ -3399,13 +3277,9 @@ function useDeleteRoomComment(roomId) {
|
|
|
3399
3277
|
store.deleteComment(threadId, optimisticId, commentId, deletedAt);
|
|
3400
3278
|
},
|
|
3401
3279
|
(err) => onMutationFailure(
|
|
3402
|
-
err,
|
|
3403
3280
|
optimisticId,
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
threadId,
|
|
3407
|
-
commentId
|
|
3408
|
-
})
|
|
3281
|
+
{ type: "DELETE_COMMENT_ERROR", roomId, threadId, commentId },
|
|
3282
|
+
err
|
|
3409
3283
|
)
|
|
3410
3284
|
);
|
|
3411
3285
|
},
|
|
@@ -3443,14 +3317,15 @@ function useAddRoomCommentReaction(roomId) {
|
|
|
3443
3317
|
);
|
|
3444
3318
|
},
|
|
3445
3319
|
(err) => onMutationFailure(
|
|
3446
|
-
err,
|
|
3447
3320
|
optimisticId,
|
|
3448
|
-
|
|
3321
|
+
{
|
|
3322
|
+
type: "ADD_REACTION_ERROR",
|
|
3449
3323
|
roomId,
|
|
3450
3324
|
threadId,
|
|
3451
3325
|
commentId,
|
|
3452
3326
|
emoji
|
|
3453
|
-
}
|
|
3327
|
+
},
|
|
3328
|
+
err
|
|
3454
3329
|
)
|
|
3455
3330
|
);
|
|
3456
3331
|
},
|
|
@@ -3487,14 +3362,15 @@ function useRemoveRoomCommentReaction(roomId) {
|
|
|
3487
3362
|
);
|
|
3488
3363
|
},
|
|
3489
3364
|
(err) => onMutationFailure(
|
|
3490
|
-
err,
|
|
3491
3365
|
optimisticId,
|
|
3492
|
-
|
|
3366
|
+
{
|
|
3367
|
+
type: "REMOVE_REACTION_ERROR",
|
|
3493
3368
|
roomId,
|
|
3494
3369
|
threadId,
|
|
3495
3370
|
commentId,
|
|
3496
3371
|
emoji
|
|
3497
|
-
}
|
|
3372
|
+
},
|
|
3373
|
+
err
|
|
3498
3374
|
)
|
|
3499
3375
|
);
|
|
3500
3376
|
},
|
|
@@ -3534,11 +3410,13 @@ function useMarkRoomThreadAsRead(roomId) {
|
|
|
3534
3410
|
},
|
|
3535
3411
|
(err) => {
|
|
3536
3412
|
onMutationFailure(
|
|
3537
|
-
err,
|
|
3538
3413
|
optimisticId,
|
|
3539
|
-
|
|
3414
|
+
{
|
|
3415
|
+
type: "MARK_INBOX_NOTIFICATION_AS_READ_ERROR",
|
|
3416
|
+
roomId,
|
|
3540
3417
|
inboxNotificationId: inboxNotification.id
|
|
3541
|
-
}
|
|
3418
|
+
},
|
|
3419
|
+
err
|
|
3542
3420
|
);
|
|
3543
3421
|
return;
|
|
3544
3422
|
}
|
|
@@ -3571,12 +3449,9 @@ function useMarkRoomThreadAsResolved(roomId) {
|
|
|
3571
3449
|
);
|
|
3572
3450
|
},
|
|
3573
3451
|
(err) => onMutationFailure(
|
|
3574
|
-
err,
|
|
3575
3452
|
optimisticId,
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
threadId
|
|
3579
|
-
})
|
|
3453
|
+
{ type: "MARK_THREAD_AS_RESOLVED_ERROR", roomId, threadId },
|
|
3454
|
+
err
|
|
3580
3455
|
)
|
|
3581
3456
|
);
|
|
3582
3457
|
},
|
|
@@ -3607,12 +3482,9 @@ function useMarkRoomThreadAsUnresolved(roomId) {
|
|
|
3607
3482
|
);
|
|
3608
3483
|
},
|
|
3609
3484
|
(err) => onMutationFailure(
|
|
3610
|
-
err,
|
|
3611
3485
|
optimisticId,
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
threadId
|
|
3615
|
-
})
|
|
3486
|
+
{ type: "MARK_THREAD_AS_UNRESOLVED_ERROR", roomId, threadId },
|
|
3487
|
+
err
|
|
3616
3488
|
)
|
|
3617
3489
|
);
|
|
3618
3490
|
},
|
|
@@ -3762,11 +3634,9 @@ function useUpdateRoomNotificationSettings() {
|
|
|
3762
3634
|
store.updateRoomNotificationSettings(room.id, optimisticId, settings2);
|
|
3763
3635
|
},
|
|
3764
3636
|
(err) => onMutationFailure(
|
|
3765
|
-
err,
|
|
3766
3637
|
optimisticId,
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
})
|
|
3638
|
+
{ type: "UPDATE_NOTIFICATION_SETTINGS_ERROR", roomId: room.id },
|
|
3639
|
+
err
|
|
3770
3640
|
)
|
|
3771
3641
|
);
|
|
3772
3642
|
},
|
|
@@ -3979,7 +3849,7 @@ export {
|
|
|
3979
3849
|
_useUserThreads_experimental,
|
|
3980
3850
|
_useUserThreadsSuspense_experimental,
|
|
3981
3851
|
useSyncStatus,
|
|
3982
|
-
|
|
3852
|
+
useErrorListener,
|
|
3983
3853
|
useStatus,
|
|
3984
3854
|
useReportTextEditor,
|
|
3985
3855
|
useYjsProvider,
|
|
@@ -3990,14 +3860,12 @@ export {
|
|
|
3990
3860
|
useStorageStatus,
|
|
3991
3861
|
useBatch,
|
|
3992
3862
|
useLostConnectionListener,
|
|
3993
|
-
useErrorListener,
|
|
3994
3863
|
useHistory,
|
|
3995
3864
|
useUndo,
|
|
3996
3865
|
useRedo,
|
|
3997
3866
|
useCanUndo,
|
|
3998
3867
|
useCanRedo,
|
|
3999
3868
|
useOthersConnectionIds,
|
|
4000
|
-
useCommentsErrorListener,
|
|
4001
3869
|
useCreateRoomThread,
|
|
4002
3870
|
useDeleteRoomThread,
|
|
4003
3871
|
useEditRoomThreadMetadata,
|
|
@@ -4057,4 +3925,4 @@ export {
|
|
|
4057
3925
|
_useStorageRoot,
|
|
4058
3926
|
_useUpdateMyPresence
|
|
4059
3927
|
};
|
|
4060
|
-
//# sourceMappingURL=chunk-
|
|
3928
|
+
//# sourceMappingURL=chunk-JZBPCFEX.mjs.map
|