@liveblocks/react 3.16.0-feeds1 → 3.16.0-flow2
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 +13 -7
- package/dist/_private.cjs.map +1 -1
- package/dist/_private.d.cts +11 -3
- package/dist/_private.d.ts +11 -3
- package/dist/_private.js +7 -1
- package/dist/_private.js.map +1 -1
- package/dist/{chunk-LYXD3YYH.js → chunk-2AIWAOIV.js} +2 -2
- package/dist/{chunk-2HO3EZRC.js → chunk-2VF57BZV.js} +39 -462
- package/dist/chunk-2VF57BZV.js.map +1 -0
- package/dist/{chunk-6D2LQWB5.cjs → chunk-6JXSC2A6.cjs} +2 -2
- package/dist/{chunk-6D2LQWB5.cjs.map → chunk-6JXSC2A6.cjs.map} +1 -1
- package/dist/{chunk-6VGVFTSY.cjs → chunk-QEGVIJNN.cjs} +74 -497
- package/dist/chunk-QEGVIJNN.cjs.map +1 -0
- package/dist/index.cjs +4 -20
- 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 +2 -18
- package/dist/index.js.map +1 -1
- package/dist/{room-C2TwdMi3.d.cts → room-BvPZu216.d.cts} +19 -195
- package/dist/{room-C2TwdMi3.d.ts → room-BvPZu216.d.ts} +19 -195
- package/dist/suspense.cjs +4 -20
- 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 +2 -18
- package/dist/suspense.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-2HO3EZRC.js.map +0 -1
- package/dist/chunk-6VGVFTSY.cjs.map +0 -1
- /package/dist/{chunk-LYXD3YYH.js.map → chunk-2AIWAOIV.js.map} +0 -0
|
@@ -27,6 +27,25 @@ 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
|
+
|
|
30
49
|
// src/ai.tsx
|
|
31
50
|
import { kInternal, nanoid } from "@liveblocks/core";
|
|
32
51
|
import { memo, useEffect as useEffect2, useId, useState } from "react";
|
|
@@ -82,7 +101,7 @@ var RegisterAiTool = memo(function RegisterAiTool2({
|
|
|
82
101
|
import {
|
|
83
102
|
useDebugValue,
|
|
84
103
|
useEffect as useEffect3,
|
|
85
|
-
useMemo,
|
|
104
|
+
useMemo as useMemo2,
|
|
86
105
|
useRef as useRef2,
|
|
87
106
|
useSyncExternalStore
|
|
88
107
|
} from "react";
|
|
@@ -101,7 +120,7 @@ function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnaps
|
|
|
101
120
|
} else {
|
|
102
121
|
inst = instRef.current;
|
|
103
122
|
}
|
|
104
|
-
const [getSelection, getServerSelection] =
|
|
123
|
+
const [getSelection, getServerSelection] = useMemo2(() => {
|
|
105
124
|
let hasMemo = false;
|
|
106
125
|
let memoizedSnapshot;
|
|
107
126
|
let memoizedSelection;
|
|
@@ -231,25 +250,6 @@ function ensureNotServerSide() {
|
|
|
231
250
|
}
|
|
232
251
|
}
|
|
233
252
|
|
|
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,12 +512,6 @@ 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
|
-
}
|
|
521
515
|
function usify(promise) {
|
|
522
516
|
if ("status" in promise) {
|
|
523
517
|
return promise;
|
|
@@ -542,12 +536,10 @@ var PaginatedResource = class {
|
|
|
542
536
|
signal;
|
|
543
537
|
#fetchPage;
|
|
544
538
|
#pendingFetchMore;
|
|
545
|
-
|
|
546
|
-
constructor(fetchPage, options) {
|
|
539
|
+
constructor(fetchPage) {
|
|
547
540
|
this.#signal = new Signal(ASYNC_LOADING);
|
|
548
541
|
this.#fetchPage = fetchPage;
|
|
549
542
|
this.#pendingFetchMore = null;
|
|
550
|
-
this.#autoRetry = options?.autoRetry ?? true;
|
|
551
543
|
this.signal = this.#signal.asReadonly();
|
|
552
544
|
autobind(this);
|
|
553
545
|
}
|
|
@@ -595,17 +587,14 @@ var PaginatedResource = class {
|
|
|
595
587
|
if (this.#cachedPromise) {
|
|
596
588
|
return this.#cachedPromise;
|
|
597
589
|
}
|
|
598
|
-
const initialPageFetch$ =
|
|
590
|
+
const initialPageFetch$ = autoRetry(
|
|
599
591
|
() => this.#fetchPage(
|
|
600
592
|
/* cursor */
|
|
601
593
|
void 0
|
|
602
594
|
),
|
|
603
595
|
5,
|
|
604
596
|
[5e3, 5e3, 1e4, 15e3]
|
|
605
|
-
)
|
|
606
|
-
/* cursor */
|
|
607
|
-
void 0
|
|
608
|
-
));
|
|
597
|
+
);
|
|
609
598
|
const promise = usify(initialPageFetch$);
|
|
610
599
|
promise.then(
|
|
611
600
|
(cursor) => {
|
|
@@ -621,12 +610,10 @@ var PaginatedResource = class {
|
|
|
621
610
|
},
|
|
622
611
|
(err) => {
|
|
623
612
|
this.#signal.set(ASYNC_ERR(err));
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}, 5e3);
|
|
629
|
-
}
|
|
613
|
+
setTimeout(() => {
|
|
614
|
+
this.#cachedPromise = null;
|
|
615
|
+
this.#signal.set(ASYNC_LOADING);
|
|
616
|
+
}, 5e3);
|
|
630
617
|
}
|
|
631
618
|
);
|
|
632
619
|
this.#cachedPromise = promise;
|
|
@@ -925,82 +912,6 @@ function createStore_forOptimistic(client) {
|
|
|
925
912
|
remove
|
|
926
913
|
};
|
|
927
914
|
}
|
|
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
|
-
}
|
|
1004
915
|
var UmbrellaStore = class {
|
|
1005
916
|
#client;
|
|
1006
917
|
//
|
|
@@ -1068,9 +979,6 @@ var UmbrellaStore = class {
|
|
|
1068
979
|
#roomVersionsLastRequestedAtByRoom = /* @__PURE__ */ new Map();
|
|
1069
980
|
// Notification Settings
|
|
1070
981
|
#notificationSettings;
|
|
1071
|
-
// Feeds
|
|
1072
|
-
#feeds = createStore_forFeeds();
|
|
1073
|
-
#feedMessages = createStore_forFeedMessages();
|
|
1074
982
|
constructor(client) {
|
|
1075
983
|
this.#client = client[kInternal2].as();
|
|
1076
984
|
this.optimisticUpdates = createStore_forOptimistic(this.#client);
|
|
@@ -1442,97 +1350,6 @@ var UmbrellaStore = class {
|
|
|
1442
1350
|
return { signal, waitUntilLoaded: resource.waitUntilLoaded };
|
|
1443
1351
|
}
|
|
1444
1352
|
);
|
|
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
|
-
);
|
|
1536
1353
|
this.outputs = {
|
|
1537
1354
|
threadifications,
|
|
1538
1355
|
threads,
|
|
@@ -1548,9 +1365,7 @@ var UmbrellaStore = class {
|
|
|
1548
1365
|
aiChats,
|
|
1549
1366
|
messagesByChatId,
|
|
1550
1367
|
aiChatById,
|
|
1551
|
-
urlMetadataByUrl
|
|
1552
|
-
loadingFeeds,
|
|
1553
|
-
loadingFeedMessages
|
|
1368
|
+
urlMetadataByUrl
|
|
1554
1369
|
};
|
|
1555
1370
|
autobind(this);
|
|
1556
1371
|
}
|
|
@@ -1771,30 +1586,6 @@ var UmbrellaStore = class {
|
|
|
1771
1586
|
result.subscriptions.deleted
|
|
1772
1587
|
);
|
|
1773
1588
|
}
|
|
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
|
-
}
|
|
1798
1589
|
async fetchUnreadNotificationsCount(queryKey, signal) {
|
|
1799
1590
|
const query = JSON.parse(queryKey);
|
|
1800
1591
|
const result = await this.#client.getUnreadInboxNotificationsCount({
|
|
@@ -3856,33 +3647,6 @@ function RoomProviderInner(props) {
|
|
|
3856
3647
|
(message) => void handleCommentEvent(message)
|
|
3857
3648
|
);
|
|
3858
3649
|
}, [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]);
|
|
3886
3650
|
useEffect6(() => {
|
|
3887
3651
|
const pair = stableEnterRoom(roomId, frozenProps);
|
|
3888
3652
|
setRoomLeavePair(pair);
|
|
@@ -4325,126 +4089,6 @@ function useThreads_withRoomContext(RoomContext, options = {}) {
|
|
|
4325
4089
|
useScrollToCommentOnLoadEffect(scrollOnLoad, result);
|
|
4326
4090
|
return result;
|
|
4327
4091
|
}
|
|
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
|
-
}
|
|
4448
4092
|
function useThreads(options = {}) {
|
|
4449
4093
|
return useThreads_withRoomContext(GlobalRoomContext, options);
|
|
4450
4094
|
}
|
|
@@ -5386,6 +5030,9 @@ function useSuspendUntilPresenceReady_withRoomContext(RoomContext) {
|
|
|
5386
5030
|
const room = useRoom_withRoomContext(RoomContext);
|
|
5387
5031
|
use(room.waitUntilPresenceReady());
|
|
5388
5032
|
}
|
|
5033
|
+
function useSuspendUntilPresenceReady() {
|
|
5034
|
+
return useSuspendUntilPresenceReady_withRoomContext(GlobalRoomContext);
|
|
5035
|
+
}
|
|
5389
5036
|
function useSelfSuspense_withRoomContext(RoomContext, selector, isEqual) {
|
|
5390
5037
|
useSuspendUntilPresenceReady_withRoomContext(RoomContext);
|
|
5391
5038
|
return useSelf_withRoomContext(
|
|
@@ -5460,6 +5107,9 @@ function useSuspendUntilStorageReady_withRoomContext(RoomContext) {
|
|
|
5460
5107
|
const room = useRoom_withRoomContext(RoomContext);
|
|
5461
5108
|
use(room.waitUntilStorageReady());
|
|
5462
5109
|
}
|
|
5110
|
+
function useSuspendUntilStorageReady() {
|
|
5111
|
+
return useSuspendUntilStorageReady_withRoomContext(GlobalRoomContext);
|
|
5112
|
+
}
|
|
5463
5113
|
function useStorageSuspense_withRoomContext(RoomContext, selector, isEqual) {
|
|
5464
5114
|
useSuspendUntilStorageReady_withRoomContext(RoomContext);
|
|
5465
5115
|
return useStorage_withRoomContext(
|
|
@@ -5748,36 +5398,6 @@ function createRoomContext(client) {
|
|
|
5748
5398
|
function useUpdateRoomSubscriptionSettings_withBoundRoomContext() {
|
|
5749
5399
|
return useUpdateRoomSubscriptionSettings_withRoomContext(BoundRoomContext);
|
|
5750
5400
|
}
|
|
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
|
-
}
|
|
5781
5401
|
const shared = createSharedContext(client);
|
|
5782
5402
|
const bundle = {
|
|
5783
5403
|
RoomContext: BoundRoomContext,
|
|
@@ -5827,22 +5447,6 @@ function createRoomContext(client) {
|
|
|
5827
5447
|
// prettier-ignore
|
|
5828
5448
|
useThreads: useThreads_withBoundRoomContext,
|
|
5829
5449
|
// 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
|
|
5846
5450
|
useCreateThread: useCreateThread_withBoundRoomContext,
|
|
5847
5451
|
// prettier-ignore
|
|
5848
5452
|
useDeleteThread: useDeleteThread_withBoundRoomContext,
|
|
@@ -5933,22 +5537,6 @@ function createRoomContext(client) {
|
|
|
5933
5537
|
// prettier-ignore
|
|
5934
5538
|
useThreads: useThreadsSuspense_withBoundRoomContext,
|
|
5935
5539
|
// 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
|
|
5952
5540
|
useCreateThread: useCreateThread_withBoundRoomContext,
|
|
5953
5541
|
// prettier-ignore
|
|
5954
5542
|
useDeleteThread: useDeleteThread_withBoundRoomContext,
|
|
@@ -6013,10 +5601,6 @@ var _useMyPresence = useMyPresence;
|
|
|
6013
5601
|
var _useOthersMapped = useOthersMapped;
|
|
6014
5602
|
var _useOthersMappedSuspense = useOthersMappedSuspense;
|
|
6015
5603
|
var _useThreads = useThreads;
|
|
6016
|
-
var _useFeeds = useFeeds;
|
|
6017
|
-
var _useFeedMessages = useFeedMessages;
|
|
6018
|
-
var _useFeedsSuspense = useFeedsSuspense;
|
|
6019
|
-
var _useFeedMessagesSuspense = useFeedMessagesSuspense;
|
|
6020
5604
|
var _useSearchComments = useSearchComments;
|
|
6021
5605
|
var _useThreadsSuspense = useThreadsSuspense;
|
|
6022
5606
|
var _useRoomSubscriptionSettings = useRoomSubscriptionSettings;
|
|
@@ -6048,6 +5632,7 @@ export {
|
|
|
6048
5632
|
useClient,
|
|
6049
5633
|
GlobalRoomContext,
|
|
6050
5634
|
useLatest,
|
|
5635
|
+
useInitial,
|
|
6051
5636
|
RegisterAiKnowledge,
|
|
6052
5637
|
RegisterAiTool,
|
|
6053
5638
|
useSyncExternalStoreWithSelector,
|
|
@@ -6103,12 +5688,6 @@ export {
|
|
|
6103
5688
|
useCanUndo,
|
|
6104
5689
|
useCanRedo,
|
|
6105
5690
|
useOthersConnectionIds,
|
|
6106
|
-
useCreateFeed,
|
|
6107
|
-
useDeleteFeed,
|
|
6108
|
-
useUpdateFeedMetadata,
|
|
6109
|
-
useCreateFeedMessage,
|
|
6110
|
-
useDeleteFeedMessage,
|
|
6111
|
-
useUpdateFeedMessage,
|
|
6112
5691
|
useCreateRoomThread,
|
|
6113
5692
|
useDeleteRoomThread,
|
|
6114
5693
|
useEditRoomThreadMetadata,
|
|
@@ -6131,7 +5710,9 @@ export {
|
|
|
6131
5710
|
useRoomThreadSubscription,
|
|
6132
5711
|
useHistoryVersionData,
|
|
6133
5712
|
useUpdateRoomSubscriptionSettings,
|
|
5713
|
+
useSuspendUntilPresenceReady,
|
|
6134
5714
|
useOthersConnectionIdsSuspense,
|
|
5715
|
+
useSuspendUntilStorageReady,
|
|
6135
5716
|
useAttachmentUrl,
|
|
6136
5717
|
useRoomAttachmentUrl,
|
|
6137
5718
|
useAttachmentUrlSuspense,
|
|
@@ -6155,10 +5736,6 @@ export {
|
|
|
6155
5736
|
_useOthersMapped,
|
|
6156
5737
|
_useOthersMappedSuspense,
|
|
6157
5738
|
_useThreads,
|
|
6158
|
-
_useFeeds,
|
|
6159
|
-
_useFeedMessages,
|
|
6160
|
-
_useFeedsSuspense,
|
|
6161
|
-
_useFeedMessagesSuspense,
|
|
6162
5739
|
_useSearchComments,
|
|
6163
5740
|
_useThreadsSuspense,
|
|
6164
5741
|
_useRoomSubscriptionSettings,
|
|
@@ -6176,4 +5753,4 @@ export {
|
|
|
6176
5753
|
_useStorageRoot,
|
|
6177
5754
|
_useUpdateMyPresence
|
|
6178
5755
|
};
|
|
6179
|
-
//# sourceMappingURL=chunk-
|
|
5756
|
+
//# sourceMappingURL=chunk-2VF57BZV.js.map
|