@liveblocks/react 3.16.0-flow2 → 3.16.0
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.cjs +7 -13
- package/dist/_private.cjs.map +1 -1
- package/dist/_private.d.cts +3 -11
- package/dist/_private.d.ts +3 -11
- package/dist/_private.js +1 -7
- package/dist/_private.js.map +1 -1
- package/dist/{chunk-2AIWAOIV.js → chunk-A7EFQVZ3.js} +2 -2
- package/dist/{chunk-2VF57BZV.js → chunk-EEXHY3OA.js} +462 -39
- package/dist/chunk-EEXHY3OA.js.map +1 -0
- package/dist/{chunk-QEGVIJNN.cjs → chunk-HFTIBRCD.cjs} +497 -74
- package/dist/chunk-HFTIBRCD.cjs.map +1 -0
- package/dist/{chunk-6JXSC2A6.cjs → chunk-VSO26OCO.cjs} +2 -2
- package/dist/{chunk-6JXSC2A6.cjs.map → chunk-VSO26OCO.cjs.map} +1 -1
- package/dist/index.cjs +20 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/{room-BvPZu216.d.cts → room-kE9R5ats.d.cts} +249 -19
- package/dist/{room-BvPZu216.d.ts → room-kE9R5ats.d.ts} +249 -19
- package/dist/suspense.cjs +20 -4
- package/dist/suspense.cjs.map +1 -1
- package/dist/suspense.d.cts +1 -1
- package/dist/suspense.d.ts +1 -1
- package/dist/suspense.js +18 -2
- package/dist/suspense.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-2VF57BZV.js.map +0 -1
- package/dist/chunk-QEGVIJNN.cjs.map +0 -1
- /package/dist/{chunk-2AIWAOIV.js.map → chunk-A7EFQVZ3.js.map} +0 -0
|
@@ -27,25 +27,6 @@ function useLatest(value) {
|
|
|
27
27
|
return ref;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
// src/lib/use-initial.ts
|
|
31
|
-
import { useCallback, useMemo } from "react";
|
|
32
|
-
function useInitial(value, roomId) {
|
|
33
|
-
return useMemo(() => value, [roomId]);
|
|
34
|
-
}
|
|
35
|
-
function useInitialUnlessFunction(latestValue, roomId) {
|
|
36
|
-
const frozenValue = useInitial(latestValue, roomId);
|
|
37
|
-
const ref = useLatest(latestValue);
|
|
38
|
-
const wrapper = useCallback(
|
|
39
|
-
(...args) => ref.current(...args),
|
|
40
|
-
[ref]
|
|
41
|
-
);
|
|
42
|
-
if (typeof frozenValue === "function") {
|
|
43
|
-
return wrapper;
|
|
44
|
-
} else {
|
|
45
|
-
return frozenValue;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
30
|
// src/ai.tsx
|
|
50
31
|
import { kInternal, nanoid } from "@liveblocks/core";
|
|
51
32
|
import { memo, useEffect as useEffect2, useId, useState } from "react";
|
|
@@ -101,7 +82,7 @@ var RegisterAiTool = memo(function RegisterAiTool2({
|
|
|
101
82
|
import {
|
|
102
83
|
useDebugValue,
|
|
103
84
|
useEffect as useEffect3,
|
|
104
|
-
useMemo
|
|
85
|
+
useMemo,
|
|
105
86
|
useRef as useRef2,
|
|
106
87
|
useSyncExternalStore
|
|
107
88
|
} from "react";
|
|
@@ -120,7 +101,7 @@ function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnaps
|
|
|
120
101
|
} else {
|
|
121
102
|
inst = instRef.current;
|
|
122
103
|
}
|
|
123
|
-
const [getSelection, getServerSelection] =
|
|
104
|
+
const [getSelection, getServerSelection] = useMemo(() => {
|
|
124
105
|
let hasMemo = false;
|
|
125
106
|
let memoizedSnapshot;
|
|
126
107
|
let memoizedSelection;
|
|
@@ -250,6 +231,25 @@ function ensureNotServerSide() {
|
|
|
250
231
|
}
|
|
251
232
|
}
|
|
252
233
|
|
|
234
|
+
// src/lib/use-initial.ts
|
|
235
|
+
import { useCallback, useMemo as useMemo2 } from "react";
|
|
236
|
+
function useInitial(value, roomId) {
|
|
237
|
+
return useMemo2(() => value, [roomId]);
|
|
238
|
+
}
|
|
239
|
+
function useInitialUnlessFunction(latestValue, roomId) {
|
|
240
|
+
const frozenValue = useInitial(latestValue, roomId);
|
|
241
|
+
const ref = useLatest(latestValue);
|
|
242
|
+
const wrapper = useCallback(
|
|
243
|
+
(...args) => ref.current(...args),
|
|
244
|
+
[ref]
|
|
245
|
+
);
|
|
246
|
+
if (typeof frozenValue === "function") {
|
|
247
|
+
return wrapper;
|
|
248
|
+
} else {
|
|
249
|
+
return frozenValue;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
253
|
// src/lib/use-polyfill.ts
|
|
254
254
|
import * as React from "react";
|
|
255
255
|
var reactUse = React[" use ".trim().toString()];
|
|
@@ -512,6 +512,12 @@ function makeAiChatsQueryKey(query) {
|
|
|
512
512
|
function makeInboxNotificationsQueryKey(query) {
|
|
513
513
|
return stableStringify(query ?? {});
|
|
514
514
|
}
|
|
515
|
+
function makeFeedsQueryKey(roomId, options) {
|
|
516
|
+
return stableStringify([roomId, options ?? {}]);
|
|
517
|
+
}
|
|
518
|
+
function makeFeedMessagesQueryKey(roomId, feedId, options) {
|
|
519
|
+
return stableStringify([roomId, feedId, options ?? {}]);
|
|
520
|
+
}
|
|
515
521
|
function usify(promise) {
|
|
516
522
|
if ("status" in promise) {
|
|
517
523
|
return promise;
|
|
@@ -536,10 +542,12 @@ var PaginatedResource = class {
|
|
|
536
542
|
signal;
|
|
537
543
|
#fetchPage;
|
|
538
544
|
#pendingFetchMore;
|
|
539
|
-
|
|
545
|
+
#autoRetry;
|
|
546
|
+
constructor(fetchPage, options) {
|
|
540
547
|
this.#signal = new Signal(ASYNC_LOADING);
|
|
541
548
|
this.#fetchPage = fetchPage;
|
|
542
549
|
this.#pendingFetchMore = null;
|
|
550
|
+
this.#autoRetry = options?.autoRetry ?? true;
|
|
543
551
|
this.signal = this.#signal.asReadonly();
|
|
544
552
|
autobind(this);
|
|
545
553
|
}
|
|
@@ -587,14 +595,17 @@ var PaginatedResource = class {
|
|
|
587
595
|
if (this.#cachedPromise) {
|
|
588
596
|
return this.#cachedPromise;
|
|
589
597
|
}
|
|
590
|
-
const initialPageFetch$ = autoRetry(
|
|
598
|
+
const initialPageFetch$ = this.#autoRetry ? autoRetry(
|
|
591
599
|
() => this.#fetchPage(
|
|
592
600
|
/* cursor */
|
|
593
601
|
void 0
|
|
594
602
|
),
|
|
595
603
|
5,
|
|
596
604
|
[5e3, 5e3, 1e4, 15e3]
|
|
597
|
-
)
|
|
605
|
+
) : Promise.resolve().then(() => this.#fetchPage(
|
|
606
|
+
/* cursor */
|
|
607
|
+
void 0
|
|
608
|
+
));
|
|
598
609
|
const promise = usify(initialPageFetch$);
|
|
599
610
|
promise.then(
|
|
600
611
|
(cursor) => {
|
|
@@ -610,10 +621,12 @@ var PaginatedResource = class {
|
|
|
610
621
|
},
|
|
611
622
|
(err) => {
|
|
612
623
|
this.#signal.set(ASYNC_ERR(err));
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
624
|
+
if (this.#autoRetry) {
|
|
625
|
+
setTimeout(() => {
|
|
626
|
+
this.#cachedPromise = null;
|
|
627
|
+
this.#signal.set(ASYNC_LOADING);
|
|
628
|
+
}, 5e3);
|
|
629
|
+
}
|
|
617
630
|
}
|
|
618
631
|
);
|
|
619
632
|
this.#cachedPromise = promise;
|
|
@@ -912,6 +925,82 @@ function createStore_forOptimistic(client) {
|
|
|
912
925
|
remove
|
|
913
926
|
};
|
|
914
927
|
}
|
|
928
|
+
function createStore_forFeeds() {
|
|
929
|
+
const signal = new MutableSignal3(/* @__PURE__ */ new Map());
|
|
930
|
+
function upsert(roomId, feeds) {
|
|
931
|
+
signal.mutate((map) => {
|
|
932
|
+
let roomMap = map.get(roomId);
|
|
933
|
+
if (!roomMap) {
|
|
934
|
+
roomMap = /* @__PURE__ */ new Map();
|
|
935
|
+
map.set(roomId, roomMap);
|
|
936
|
+
}
|
|
937
|
+
for (const feed of feeds) {
|
|
938
|
+
roomMap.set(feed.feedId, feed);
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
function deleteOne(roomId, feedId) {
|
|
943
|
+
signal.mutate((map) => {
|
|
944
|
+
map.get(roomId)?.delete(feedId);
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
function findMany(feedsByRoomId, roomId, options) {
|
|
948
|
+
const filtered = Array.from(
|
|
949
|
+
feedsByRoomId.get(roomId)?.values() ?? []
|
|
950
|
+
).filter((feed) => {
|
|
951
|
+
if (options?.since !== void 0 && feed.updatedAt < options.since && feed.createdAt < options.since) {
|
|
952
|
+
return false;
|
|
953
|
+
}
|
|
954
|
+
if (options?.metadata !== void 0) {
|
|
955
|
+
const meta = feed.metadata;
|
|
956
|
+
if (!Object.entries(options.metadata).every(([k, v]) => meta[k] === v)) {
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return true;
|
|
961
|
+
});
|
|
962
|
+
filtered.sort((a, b) => {
|
|
963
|
+
const byTime = a.createdAt - b.createdAt;
|
|
964
|
+
if (byTime !== 0) return byTime;
|
|
965
|
+
return a.feedId < b.feedId ? -1 : a.feedId > b.feedId ? 1 : 0;
|
|
966
|
+
});
|
|
967
|
+
return filtered;
|
|
968
|
+
}
|
|
969
|
+
return { signal, upsert, delete: deleteOne, findMany };
|
|
970
|
+
}
|
|
971
|
+
function createStore_forFeedMessages() {
|
|
972
|
+
const signal = new MutableSignal3(
|
|
973
|
+
/* @__PURE__ */ new Map()
|
|
974
|
+
);
|
|
975
|
+
function upsert(feedId, messages) {
|
|
976
|
+
signal.mutate((map) => {
|
|
977
|
+
let feedMap = map.get(feedId);
|
|
978
|
+
if (!feedMap) {
|
|
979
|
+
feedMap = /* @__PURE__ */ new Map();
|
|
980
|
+
map.set(feedId, feedMap);
|
|
981
|
+
}
|
|
982
|
+
for (const msg of messages) {
|
|
983
|
+
feedMap.set(msg.id, msg);
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
function deleteOne(feedId, messageIds) {
|
|
988
|
+
signal.mutate((map) => {
|
|
989
|
+
const feedMap = map.get(feedId);
|
|
990
|
+
if (feedMap) {
|
|
991
|
+
for (const id of messageIds) {
|
|
992
|
+
feedMap.delete(id);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
function findMany(messagesByFeedId, feedId) {
|
|
998
|
+
return Array.from(messagesByFeedId.get(feedId)?.values() ?? []).sort(
|
|
999
|
+
(a, b) => a.createdAt - b.createdAt
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
return { signal, upsert, delete: deleteOne, findMany };
|
|
1003
|
+
}
|
|
915
1004
|
var UmbrellaStore = class {
|
|
916
1005
|
#client;
|
|
917
1006
|
//
|
|
@@ -979,6 +1068,9 @@ var UmbrellaStore = class {
|
|
|
979
1068
|
#roomVersionsLastRequestedAtByRoom = /* @__PURE__ */ new Map();
|
|
980
1069
|
// Notification Settings
|
|
981
1070
|
#notificationSettings;
|
|
1071
|
+
// Feeds
|
|
1072
|
+
#feeds = createStore_forFeeds();
|
|
1073
|
+
#feedMessages = createStore_forFeedMessages();
|
|
982
1074
|
constructor(client) {
|
|
983
1075
|
this.#client = client[kInternal2].as();
|
|
984
1076
|
this.optimisticUpdates = createStore_forOptimistic(this.#client);
|
|
@@ -1350,6 +1442,97 @@ var UmbrellaStore = class {
|
|
|
1350
1442
|
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
1351
1443
|
}
|
|
1352
1444
|
);
|
|
1445
|
+
const loadingFeeds = new DefaultMap(
|
|
1446
|
+
(queryKey) => {
|
|
1447
|
+
const [roomId, options] = JSON.parse(queryKey);
|
|
1448
|
+
const resource = new PaginatedResource(
|
|
1449
|
+
async (cursor) => {
|
|
1450
|
+
const room = this.#client.getRoom(roomId);
|
|
1451
|
+
if (room === null) {
|
|
1452
|
+
throw new Error(
|
|
1453
|
+
`Room '${roomId}' is not available on client. Make sure you're calling useFeeds inside a RoomProvider.`
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
const result = await room.fetchFeeds({
|
|
1457
|
+
cursor,
|
|
1458
|
+
since: options?.since,
|
|
1459
|
+
metadata: options?.metadata,
|
|
1460
|
+
limit: options?.limit
|
|
1461
|
+
});
|
|
1462
|
+
this.upsertFeeds(roomId, result.feeds);
|
|
1463
|
+
return result.nextCursor ?? null;
|
|
1464
|
+
},
|
|
1465
|
+
{ autoRetry: false }
|
|
1466
|
+
);
|
|
1467
|
+
const signal = DerivedSignal.from(
|
|
1468
|
+
resource.signal,
|
|
1469
|
+
this.#feeds.signal,
|
|
1470
|
+
(resourceResult, feedsByRoomId) => {
|
|
1471
|
+
if (resourceResult.isLoading || resourceResult.error) {
|
|
1472
|
+
return resourceResult;
|
|
1473
|
+
}
|
|
1474
|
+
const feeds = this.#feeds.findMany(feedsByRoomId, roomId, options);
|
|
1475
|
+
const page = resourceResult.data;
|
|
1476
|
+
return {
|
|
1477
|
+
isLoading: false,
|
|
1478
|
+
feeds,
|
|
1479
|
+
hasFetchedAll: page.hasFetchedAll,
|
|
1480
|
+
isFetchingMore: page.isFetchingMore,
|
|
1481
|
+
fetchMoreError: page.fetchMoreError,
|
|
1482
|
+
fetchMore: page.fetchMore
|
|
1483
|
+
};
|
|
1484
|
+
},
|
|
1485
|
+
shallow2
|
|
1486
|
+
);
|
|
1487
|
+
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
1488
|
+
}
|
|
1489
|
+
);
|
|
1490
|
+
const loadingFeedMessages = new DefaultMap(
|
|
1491
|
+
(queryKey) => {
|
|
1492
|
+
const [roomId, feedId, options] = JSON.parse(queryKey);
|
|
1493
|
+
const resource = new PaginatedResource(
|
|
1494
|
+
async (cursor) => {
|
|
1495
|
+
const room = this.#client.getRoom(roomId);
|
|
1496
|
+
if (room === null) {
|
|
1497
|
+
throw new Error(
|
|
1498
|
+
`Room '${roomId}' is not available on client. Make sure you're calling useFeedMessages inside a RoomProvider.`
|
|
1499
|
+
);
|
|
1500
|
+
}
|
|
1501
|
+
const result = await room.fetchFeedMessages(feedId, {
|
|
1502
|
+
cursor,
|
|
1503
|
+
limit: options?.limit
|
|
1504
|
+
});
|
|
1505
|
+
this.upsertFeedMessages(roomId, feedId, result.messages);
|
|
1506
|
+
return result.nextCursor ?? null;
|
|
1507
|
+
},
|
|
1508
|
+
{ autoRetry: false }
|
|
1509
|
+
);
|
|
1510
|
+
const signal = DerivedSignal.from(
|
|
1511
|
+
resource.signal,
|
|
1512
|
+
this.#feedMessages.signal,
|
|
1513
|
+
(resourceResult, messagesByFeedId) => {
|
|
1514
|
+
if (resourceResult.isLoading || resourceResult.error) {
|
|
1515
|
+
return resourceResult;
|
|
1516
|
+
}
|
|
1517
|
+
const messages = this.#feedMessages.findMany(
|
|
1518
|
+
messagesByFeedId,
|
|
1519
|
+
feedId
|
|
1520
|
+
);
|
|
1521
|
+
const page = resourceResult.data;
|
|
1522
|
+
return {
|
|
1523
|
+
isLoading: false,
|
|
1524
|
+
messages,
|
|
1525
|
+
hasFetchedAll: page.hasFetchedAll,
|
|
1526
|
+
isFetchingMore: page.isFetchingMore,
|
|
1527
|
+
fetchMoreError: page.fetchMoreError,
|
|
1528
|
+
fetchMore: page.fetchMore
|
|
1529
|
+
};
|
|
1530
|
+
},
|
|
1531
|
+
shallow2
|
|
1532
|
+
);
|
|
1533
|
+
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
1534
|
+
}
|
|
1535
|
+
);
|
|
1353
1536
|
this.outputs = {
|
|
1354
1537
|
threadifications,
|
|
1355
1538
|
threads,
|
|
@@ -1365,7 +1548,9 @@ var UmbrellaStore = class {
|
|
|
1365
1548
|
aiChats,
|
|
1366
1549
|
messagesByChatId,
|
|
1367
1550
|
aiChatById,
|
|
1368
|
-
urlMetadataByUrl
|
|
1551
|
+
urlMetadataByUrl,
|
|
1552
|
+
loadingFeeds,
|
|
1553
|
+
loadingFeedMessages
|
|
1369
1554
|
};
|
|
1370
1555
|
autobind(this);
|
|
1371
1556
|
}
|
|
@@ -1586,6 +1771,30 @@ var UmbrellaStore = class {
|
|
|
1586
1771
|
result.subscriptions.deleted
|
|
1587
1772
|
);
|
|
1588
1773
|
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Upserts feeds in the cache (for list/added/updated operations).
|
|
1776
|
+
*/
|
|
1777
|
+
upsertFeeds(roomId, feeds) {
|
|
1778
|
+
this.#feeds.upsert(roomId, feeds);
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* Removes a feed from the cache (for deleted operations).
|
|
1782
|
+
*/
|
|
1783
|
+
deleteFeed(roomId, feedId) {
|
|
1784
|
+
this.#feeds.delete(roomId, feedId);
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Upserts feed messages in the cache (for list/added/updated operations).
|
|
1788
|
+
*/
|
|
1789
|
+
upsertFeedMessages(_roomId, feedId, messages) {
|
|
1790
|
+
this.#feedMessages.upsert(feedId, messages);
|
|
1791
|
+
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Removes feed messages from the cache (for deleted operations).
|
|
1794
|
+
*/
|
|
1795
|
+
deleteFeedMessages(_roomId, feedId, messageIds) {
|
|
1796
|
+
this.#feedMessages.delete(feedId, messageIds);
|
|
1797
|
+
}
|
|
1589
1798
|
async fetchUnreadNotificationsCount(queryKey, signal) {
|
|
1590
1799
|
const query = JSON.parse(queryKey);
|
|
1591
1800
|
const result = await this.#client.getUnreadInboxNotificationsCount({
|
|
@@ -3647,6 +3856,33 @@ function RoomProviderInner(props) {
|
|
|
3647
3856
|
(message) => void handleCommentEvent(message)
|
|
3648
3857
|
);
|
|
3649
3858
|
}, [client, room]);
|
|
3859
|
+
useEffect6(() => {
|
|
3860
|
+
const { store } = getRoomExtrasForClient(client);
|
|
3861
|
+
function handleFeedEvent(message) {
|
|
3862
|
+
switch (message.type) {
|
|
3863
|
+
case ServerMsgCode.FEEDS_ADDED:
|
|
3864
|
+
case ServerMsgCode.FEEDS_UPDATED:
|
|
3865
|
+
store.upsertFeeds(room.id, message.feeds);
|
|
3866
|
+
break;
|
|
3867
|
+
case ServerMsgCode.FEED_DELETED:
|
|
3868
|
+
store.deleteFeed(room.id, message.feedId);
|
|
3869
|
+
break;
|
|
3870
|
+
case ServerMsgCode.FEED_MESSAGES_ADDED:
|
|
3871
|
+
case ServerMsgCode.FEED_MESSAGES_UPDATED:
|
|
3872
|
+
store.upsertFeedMessages(room.id, message.feedId, message.messages);
|
|
3873
|
+
break;
|
|
3874
|
+
case ServerMsgCode.FEED_MESSAGES_DELETED:
|
|
3875
|
+
store.deleteFeedMessages(room.id, message.feedId, message.messageIds);
|
|
3876
|
+
break;
|
|
3877
|
+
// FEEDS_LIST and FEED_MESSAGES_LIST are handled by fetch promise resolution in room.ts
|
|
3878
|
+
default:
|
|
3879
|
+
break;
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
return room.events.feeds.subscribe(
|
|
3883
|
+
(message) => void handleFeedEvent(message)
|
|
3884
|
+
);
|
|
3885
|
+
}, [client, room]);
|
|
3650
3886
|
useEffect6(() => {
|
|
3651
3887
|
const pair = stableEnterRoom(roomId, frozenProps);
|
|
3652
3888
|
setRoomLeavePair(pair);
|
|
@@ -4089,6 +4325,126 @@ function useThreads_withRoomContext(RoomContext, options = {}) {
|
|
|
4089
4325
|
useScrollToCommentOnLoadEffect(scrollOnLoad, result);
|
|
4090
4326
|
return result;
|
|
4091
4327
|
}
|
|
4328
|
+
function useFeeds_withRoomContext(RoomContext, options) {
|
|
4329
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4330
|
+
const client = useClient();
|
|
4331
|
+
const { store } = getRoomExtrasForClient(client);
|
|
4332
|
+
const queryKey = makeFeedsQueryKey(room.id, options);
|
|
4333
|
+
const loadableResource = store.outputs.loadingFeeds.getOrCreate(queryKey);
|
|
4334
|
+
useEffect6(() => {
|
|
4335
|
+
void loadableResource.waitUntilLoaded();
|
|
4336
|
+
}, [room, loadableResource]);
|
|
4337
|
+
return useSignal(loadableResource.signal);
|
|
4338
|
+
}
|
|
4339
|
+
function useFeeds(options) {
|
|
4340
|
+
return useFeeds_withRoomContext(GlobalRoomContext, options);
|
|
4341
|
+
}
|
|
4342
|
+
function useFeedMessages_withRoomContext(RoomContext, feedId, options) {
|
|
4343
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4344
|
+
const client = useClient();
|
|
4345
|
+
const { store } = getRoomExtrasForClient(client);
|
|
4346
|
+
const queryKey = makeFeedMessagesQueryKey(room.id, feedId, options);
|
|
4347
|
+
useEffect6(() => {
|
|
4348
|
+
void store.outputs.loadingFeedMessages.getOrCreate(queryKey).waitUntilLoaded();
|
|
4349
|
+
});
|
|
4350
|
+
return useSignal(
|
|
4351
|
+
store.outputs.loadingFeedMessages.getOrCreate(queryKey).signal
|
|
4352
|
+
);
|
|
4353
|
+
}
|
|
4354
|
+
function useFeedMessages(feedId, options) {
|
|
4355
|
+
return useFeedMessages_withRoomContext(GlobalRoomContext, feedId, options);
|
|
4356
|
+
}
|
|
4357
|
+
function useFeedsSuspense_withRoomContext(RoomContext, options) {
|
|
4358
|
+
ensureNotServerSide();
|
|
4359
|
+
const client = useClient();
|
|
4360
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4361
|
+
const { store } = getRoomExtrasForClient(client);
|
|
4362
|
+
const queryKey = makeFeedsQueryKey(room.id, options);
|
|
4363
|
+
use(store.outputs.loadingFeeds.getOrCreate(queryKey).waitUntilLoaded());
|
|
4364
|
+
const result = useFeeds_withRoomContext(RoomContext, options);
|
|
4365
|
+
assert2(!result.error, "Did not expect error");
|
|
4366
|
+
assert2(!result.isLoading, "Did not expect loading");
|
|
4367
|
+
return result;
|
|
4368
|
+
}
|
|
4369
|
+
function useFeedsSuspense(options) {
|
|
4370
|
+
return useFeedsSuspense_withRoomContext(GlobalRoomContext, options);
|
|
4371
|
+
}
|
|
4372
|
+
function useFeedMessagesSuspense_withRoomContext(RoomContext, feedId, options) {
|
|
4373
|
+
ensureNotServerSide();
|
|
4374
|
+
const client = useClient();
|
|
4375
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4376
|
+
const { store } = getRoomExtrasForClient(client);
|
|
4377
|
+
const queryKey = makeFeedMessagesQueryKey(room.id, feedId, options);
|
|
4378
|
+
use(store.outputs.loadingFeedMessages.getOrCreate(queryKey).waitUntilLoaded());
|
|
4379
|
+
const result = useFeedMessages_withRoomContext(RoomContext, feedId, options);
|
|
4380
|
+
assert2(!result.error, "Did not expect error");
|
|
4381
|
+
assert2(!result.isLoading, "Did not expect loading");
|
|
4382
|
+
return result;
|
|
4383
|
+
}
|
|
4384
|
+
function useFeedMessagesSuspense(feedId, options) {
|
|
4385
|
+
return useFeedMessagesSuspense_withRoomContext(
|
|
4386
|
+
GlobalRoomContext,
|
|
4387
|
+
feedId,
|
|
4388
|
+
options
|
|
4389
|
+
);
|
|
4390
|
+
}
|
|
4391
|
+
function useCreateFeed_withRoomContext(RoomContext) {
|
|
4392
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4393
|
+
return useCallback3(
|
|
4394
|
+
(feedId, options) => room.addFeed(feedId, options),
|
|
4395
|
+
[room]
|
|
4396
|
+
);
|
|
4397
|
+
}
|
|
4398
|
+
function useCreateFeed() {
|
|
4399
|
+
return useCreateFeed_withRoomContext(GlobalRoomContext);
|
|
4400
|
+
}
|
|
4401
|
+
function useDeleteFeed_withRoomContext(RoomContext) {
|
|
4402
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4403
|
+
return useCallback3((feedId) => room.deleteFeed(feedId), [room]);
|
|
4404
|
+
}
|
|
4405
|
+
function useDeleteFeed() {
|
|
4406
|
+
return useDeleteFeed_withRoomContext(GlobalRoomContext);
|
|
4407
|
+
}
|
|
4408
|
+
function useUpdateFeedMetadata_withRoomContext(RoomContext) {
|
|
4409
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4410
|
+
return useCallback3(
|
|
4411
|
+
(feedId, metadata) => room.updateFeed(feedId, metadata),
|
|
4412
|
+
[room]
|
|
4413
|
+
);
|
|
4414
|
+
}
|
|
4415
|
+
function useUpdateFeedMetadata() {
|
|
4416
|
+
return useUpdateFeedMetadata_withRoomContext(GlobalRoomContext);
|
|
4417
|
+
}
|
|
4418
|
+
function useCreateFeedMessage_withRoomContext(RoomContext) {
|
|
4419
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4420
|
+
return useCallback3(
|
|
4421
|
+
(feedId, data, options) => room.addFeedMessage(feedId, data, options),
|
|
4422
|
+
[room]
|
|
4423
|
+
);
|
|
4424
|
+
}
|
|
4425
|
+
function useCreateFeedMessage() {
|
|
4426
|
+
return useCreateFeedMessage_withRoomContext(GlobalRoomContext);
|
|
4427
|
+
}
|
|
4428
|
+
function useDeleteFeedMessage_withRoomContext(RoomContext) {
|
|
4429
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4430
|
+
return useCallback3(
|
|
4431
|
+
(feedId, messageId) => room.deleteFeedMessage(feedId, messageId),
|
|
4432
|
+
[room]
|
|
4433
|
+
);
|
|
4434
|
+
}
|
|
4435
|
+
function useDeleteFeedMessage() {
|
|
4436
|
+
return useDeleteFeedMessage_withRoomContext(GlobalRoomContext);
|
|
4437
|
+
}
|
|
4438
|
+
function useUpdateFeedMessage_withRoomContext(RoomContext) {
|
|
4439
|
+
const room = useRoom_withRoomContext(RoomContext);
|
|
4440
|
+
return useCallback3(
|
|
4441
|
+
(feedId, messageId, data, options) => room.updateFeedMessage(feedId, messageId, data, options),
|
|
4442
|
+
[room]
|
|
4443
|
+
);
|
|
4444
|
+
}
|
|
4445
|
+
function useUpdateFeedMessage() {
|
|
4446
|
+
return useUpdateFeedMessage_withRoomContext(GlobalRoomContext);
|
|
4447
|
+
}
|
|
4092
4448
|
function useThreads(options = {}) {
|
|
4093
4449
|
return useThreads_withRoomContext(GlobalRoomContext, options);
|
|
4094
4450
|
}
|
|
@@ -5030,9 +5386,6 @@ function useSuspendUntilPresenceReady_withRoomContext(RoomContext) {
|
|
|
5030
5386
|
const room = useRoom_withRoomContext(RoomContext);
|
|
5031
5387
|
use(room.waitUntilPresenceReady());
|
|
5032
5388
|
}
|
|
5033
|
-
function useSuspendUntilPresenceReady() {
|
|
5034
|
-
return useSuspendUntilPresenceReady_withRoomContext(GlobalRoomContext);
|
|
5035
|
-
}
|
|
5036
5389
|
function useSelfSuspense_withRoomContext(RoomContext, selector, isEqual) {
|
|
5037
5390
|
useSuspendUntilPresenceReady_withRoomContext(RoomContext);
|
|
5038
5391
|
return useSelf_withRoomContext(
|
|
@@ -5107,9 +5460,6 @@ function useSuspendUntilStorageReady_withRoomContext(RoomContext) {
|
|
|
5107
5460
|
const room = useRoom_withRoomContext(RoomContext);
|
|
5108
5461
|
use(room.waitUntilStorageReady());
|
|
5109
5462
|
}
|
|
5110
|
-
function useSuspendUntilStorageReady() {
|
|
5111
|
-
return useSuspendUntilStorageReady_withRoomContext(GlobalRoomContext);
|
|
5112
|
-
}
|
|
5113
5463
|
function useStorageSuspense_withRoomContext(RoomContext, selector, isEqual) {
|
|
5114
5464
|
useSuspendUntilStorageReady_withRoomContext(RoomContext);
|
|
5115
5465
|
return useStorage_withRoomContext(
|
|
@@ -5398,6 +5748,36 @@ function createRoomContext(client) {
|
|
|
5398
5748
|
function useUpdateRoomSubscriptionSettings_withBoundRoomContext() {
|
|
5399
5749
|
return useUpdateRoomSubscriptionSettings_withRoomContext(BoundRoomContext);
|
|
5400
5750
|
}
|
|
5751
|
+
function useFeeds_withBoundRoomContext(...args) {
|
|
5752
|
+
return useFeeds_withRoomContext(BoundRoomContext, ...args);
|
|
5753
|
+
}
|
|
5754
|
+
function useFeedMessages_withBoundRoomContext(...args) {
|
|
5755
|
+
return useFeedMessages_withRoomContext(BoundRoomContext, ...args);
|
|
5756
|
+
}
|
|
5757
|
+
function useFeedsSuspense_withBoundRoomContext(...args) {
|
|
5758
|
+
return useFeedsSuspense_withRoomContext(BoundRoomContext, ...args);
|
|
5759
|
+
}
|
|
5760
|
+
function useFeedMessagesSuspense_withBoundRoomContext(...args) {
|
|
5761
|
+
return useFeedMessagesSuspense_withRoomContext(BoundRoomContext, ...args);
|
|
5762
|
+
}
|
|
5763
|
+
function useCreateFeed_withBoundRoomContext() {
|
|
5764
|
+
return useCreateFeed_withRoomContext(BoundRoomContext);
|
|
5765
|
+
}
|
|
5766
|
+
function useDeleteFeed_withBoundRoomContext() {
|
|
5767
|
+
return useDeleteFeed_withRoomContext(BoundRoomContext);
|
|
5768
|
+
}
|
|
5769
|
+
function useUpdateFeedMetadata_withBoundRoomContext() {
|
|
5770
|
+
return useUpdateFeedMetadata_withRoomContext(BoundRoomContext);
|
|
5771
|
+
}
|
|
5772
|
+
function useCreateFeedMessage_withBoundRoomContext() {
|
|
5773
|
+
return useCreateFeedMessage_withRoomContext(BoundRoomContext);
|
|
5774
|
+
}
|
|
5775
|
+
function useDeleteFeedMessage_withBoundRoomContext() {
|
|
5776
|
+
return useDeleteFeedMessage_withRoomContext(BoundRoomContext);
|
|
5777
|
+
}
|
|
5778
|
+
function useUpdateFeedMessage_withBoundRoomContext() {
|
|
5779
|
+
return useUpdateFeedMessage_withRoomContext(BoundRoomContext);
|
|
5780
|
+
}
|
|
5401
5781
|
const shared = createSharedContext(client);
|
|
5402
5782
|
const bundle = {
|
|
5403
5783
|
RoomContext: BoundRoomContext,
|
|
@@ -5447,6 +5827,22 @@ function createRoomContext(client) {
|
|
|
5447
5827
|
// prettier-ignore
|
|
5448
5828
|
useThreads: useThreads_withBoundRoomContext,
|
|
5449
5829
|
// prettier-ignore
|
|
5830
|
+
useFeeds: useFeeds_withBoundRoomContext,
|
|
5831
|
+
// prettier-ignore
|
|
5832
|
+
useFeedMessages: useFeedMessages_withBoundRoomContext,
|
|
5833
|
+
// prettier-ignore
|
|
5834
|
+
useCreateFeed: useCreateFeed_withBoundRoomContext,
|
|
5835
|
+
// prettier-ignore
|
|
5836
|
+
useDeleteFeed: useDeleteFeed_withBoundRoomContext,
|
|
5837
|
+
// prettier-ignore
|
|
5838
|
+
useUpdateFeedMetadata: useUpdateFeedMetadata_withBoundRoomContext,
|
|
5839
|
+
// prettier-ignore
|
|
5840
|
+
useCreateFeedMessage: useCreateFeedMessage_withBoundRoomContext,
|
|
5841
|
+
// prettier-ignore
|
|
5842
|
+
useDeleteFeedMessage: useDeleteFeedMessage_withBoundRoomContext,
|
|
5843
|
+
// prettier-ignore
|
|
5844
|
+
useUpdateFeedMessage: useUpdateFeedMessage_withBoundRoomContext,
|
|
5845
|
+
// prettier-ignore
|
|
5450
5846
|
useCreateThread: useCreateThread_withBoundRoomContext,
|
|
5451
5847
|
// prettier-ignore
|
|
5452
5848
|
useDeleteThread: useDeleteThread_withBoundRoomContext,
|
|
@@ -5537,6 +5933,22 @@ function createRoomContext(client) {
|
|
|
5537
5933
|
// prettier-ignore
|
|
5538
5934
|
useThreads: useThreadsSuspense_withBoundRoomContext,
|
|
5539
5935
|
// prettier-ignore
|
|
5936
|
+
useFeeds: useFeedsSuspense_withBoundRoomContext,
|
|
5937
|
+
// prettier-ignore
|
|
5938
|
+
useFeedMessages: useFeedMessagesSuspense_withBoundRoomContext,
|
|
5939
|
+
// prettier-ignore
|
|
5940
|
+
useCreateFeed: useCreateFeed_withBoundRoomContext,
|
|
5941
|
+
// prettier-ignore
|
|
5942
|
+
useDeleteFeed: useDeleteFeed_withBoundRoomContext,
|
|
5943
|
+
// prettier-ignore
|
|
5944
|
+
useUpdateFeedMetadata: useUpdateFeedMetadata_withBoundRoomContext,
|
|
5945
|
+
// prettier-ignore
|
|
5946
|
+
useCreateFeedMessage: useCreateFeedMessage_withBoundRoomContext,
|
|
5947
|
+
// prettier-ignore
|
|
5948
|
+
useDeleteFeedMessage: useDeleteFeedMessage_withBoundRoomContext,
|
|
5949
|
+
// prettier-ignore
|
|
5950
|
+
useUpdateFeedMessage: useUpdateFeedMessage_withBoundRoomContext,
|
|
5951
|
+
// prettier-ignore
|
|
5540
5952
|
useCreateThread: useCreateThread_withBoundRoomContext,
|
|
5541
5953
|
// prettier-ignore
|
|
5542
5954
|
useDeleteThread: useDeleteThread_withBoundRoomContext,
|
|
@@ -5601,6 +6013,10 @@ var _useMyPresence = useMyPresence;
|
|
|
5601
6013
|
var _useOthersMapped = useOthersMapped;
|
|
5602
6014
|
var _useOthersMappedSuspense = useOthersMappedSuspense;
|
|
5603
6015
|
var _useThreads = useThreads;
|
|
6016
|
+
var _useFeeds = useFeeds;
|
|
6017
|
+
var _useFeedMessages = useFeedMessages;
|
|
6018
|
+
var _useFeedsSuspense = useFeedsSuspense;
|
|
6019
|
+
var _useFeedMessagesSuspense = useFeedMessagesSuspense;
|
|
5604
6020
|
var _useSearchComments = useSearchComments;
|
|
5605
6021
|
var _useThreadsSuspense = useThreadsSuspense;
|
|
5606
6022
|
var _useRoomSubscriptionSettings = useRoomSubscriptionSettings;
|
|
@@ -5632,7 +6048,6 @@ export {
|
|
|
5632
6048
|
useClient,
|
|
5633
6049
|
GlobalRoomContext,
|
|
5634
6050
|
useLatest,
|
|
5635
|
-
useInitial,
|
|
5636
6051
|
RegisterAiKnowledge,
|
|
5637
6052
|
RegisterAiTool,
|
|
5638
6053
|
useSyncExternalStoreWithSelector,
|
|
@@ -5688,6 +6103,12 @@ export {
|
|
|
5688
6103
|
useCanUndo,
|
|
5689
6104
|
useCanRedo,
|
|
5690
6105
|
useOthersConnectionIds,
|
|
6106
|
+
useCreateFeed,
|
|
6107
|
+
useDeleteFeed,
|
|
6108
|
+
useUpdateFeedMetadata,
|
|
6109
|
+
useCreateFeedMessage,
|
|
6110
|
+
useDeleteFeedMessage,
|
|
6111
|
+
useUpdateFeedMessage,
|
|
5691
6112
|
useCreateRoomThread,
|
|
5692
6113
|
useDeleteRoomThread,
|
|
5693
6114
|
useEditRoomThreadMetadata,
|
|
@@ -5710,9 +6131,7 @@ export {
|
|
|
5710
6131
|
useRoomThreadSubscription,
|
|
5711
6132
|
useHistoryVersionData,
|
|
5712
6133
|
useUpdateRoomSubscriptionSettings,
|
|
5713
|
-
useSuspendUntilPresenceReady,
|
|
5714
6134
|
useOthersConnectionIdsSuspense,
|
|
5715
|
-
useSuspendUntilStorageReady,
|
|
5716
6135
|
useAttachmentUrl,
|
|
5717
6136
|
useRoomAttachmentUrl,
|
|
5718
6137
|
useAttachmentUrlSuspense,
|
|
@@ -5736,6 +6155,10 @@ export {
|
|
|
5736
6155
|
_useOthersMapped,
|
|
5737
6156
|
_useOthersMappedSuspense,
|
|
5738
6157
|
_useThreads,
|
|
6158
|
+
_useFeeds,
|
|
6159
|
+
_useFeedMessages,
|
|
6160
|
+
_useFeedsSuspense,
|
|
6161
|
+
_useFeedMessagesSuspense,
|
|
5739
6162
|
_useSearchComments,
|
|
5740
6163
|
_useThreadsSuspense,
|
|
5741
6164
|
_useRoomSubscriptionSettings,
|
|
@@ -5753,4 +6176,4 @@ export {
|
|
|
5753
6176
|
_useStorageRoot,
|
|
5754
6177
|
_useUpdateMyPresence
|
|
5755
6178
|
};
|
|
5756
|
-
//# sourceMappingURL=chunk-
|
|
6179
|
+
//# sourceMappingURL=chunk-EEXHY3OA.js.map
|