@liveblocks/react 1.4.5 → 1.4.6-test1
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/index.d.mts +33 -11
- package/dist/index.d.ts +33 -11
- package/dist/index.js +57 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -28,6 +28,9 @@ declare type Props = {
|
|
|
28
28
|
*/
|
|
29
29
|
declare function ClientSideSuspense(props: Props): ReactElement;
|
|
30
30
|
|
|
31
|
+
declare type PartialNullable<T> = {
|
|
32
|
+
[P in keyof T]?: T[P] | null | undefined;
|
|
33
|
+
};
|
|
31
34
|
declare type CreateThreadOptions<TMetadata extends BaseMetadata> = [
|
|
32
35
|
TMetadata
|
|
33
36
|
] extends [never] ? {
|
|
@@ -42,7 +45,7 @@ declare type EditThreadMetadataOptions<TMetadata extends BaseMetadata> = [
|
|
|
42
45
|
threadId: string;
|
|
43
46
|
} : {
|
|
44
47
|
threadId: string;
|
|
45
|
-
metadata:
|
|
48
|
+
metadata: Resolve<PartialNullable<TMetadata>>;
|
|
46
49
|
};
|
|
47
50
|
declare type CreateCommentOptions = {
|
|
48
51
|
threadId: string;
|
|
@@ -79,11 +82,25 @@ declare type ThreadsStateSuccess<TThreadMetadata extends BaseMetadata> = {
|
|
|
79
82
|
};
|
|
80
83
|
declare type ThreadsState<TThreadMetadata extends BaseMetadata> = ThreadsStateLoading | ThreadsStateError | ThreadsStateSuccess<TThreadMetadata>;
|
|
81
84
|
|
|
82
|
-
declare type
|
|
83
|
-
|
|
85
|
+
declare type PromiseOrNot<T> = T | Promise<T>;
|
|
86
|
+
declare type ResolveUsersArgs = {
|
|
87
|
+
/**
|
|
88
|
+
* The ID of the current room.
|
|
89
|
+
*/
|
|
90
|
+
roomId: string;
|
|
91
|
+
/**
|
|
92
|
+
* The ID of the users to resolve.
|
|
93
|
+
*/
|
|
94
|
+
userIds: string;
|
|
84
95
|
};
|
|
85
|
-
declare type
|
|
96
|
+
declare type ResolveMentionSuggestionsArgs = {
|
|
97
|
+
/**
|
|
98
|
+
* The ID of the current room.
|
|
99
|
+
*/
|
|
86
100
|
roomId: string;
|
|
101
|
+
/**
|
|
102
|
+
* The text to search for.
|
|
103
|
+
*/
|
|
87
104
|
text: string;
|
|
88
105
|
};
|
|
89
106
|
declare type UserStateLoading = {
|
|
@@ -439,6 +456,7 @@ declare type RoomContextBundleShared<TPresence extends JsonObject, TStorage exte
|
|
|
439
456
|
* @beta
|
|
440
457
|
*
|
|
441
458
|
* Returns a function that edits a thread's metadata.
|
|
459
|
+
* To delete an existing metadata property, set its value to `null`.
|
|
442
460
|
*
|
|
443
461
|
* @example
|
|
444
462
|
* const editThreadMetadata = useEditThreadMetadata();
|
|
@@ -742,15 +760,15 @@ declare type Options<TUserMeta extends BaseUserMeta> = {
|
|
|
742
760
|
/**
|
|
743
761
|
* @beta
|
|
744
762
|
*
|
|
745
|
-
*
|
|
763
|
+
* A function that returns user info from user IDs.
|
|
746
764
|
*/
|
|
747
|
-
|
|
765
|
+
resolveUsers?: (args: ResolveUsersArgs) => PromiseOrNot<TUserMeta["info"] | undefined>;
|
|
748
766
|
/**
|
|
749
767
|
* @beta
|
|
750
768
|
*
|
|
751
|
-
*
|
|
769
|
+
* A function that returns a list of user IDs matching a string.
|
|
752
770
|
*/
|
|
753
|
-
resolveMentionSuggestions?: (
|
|
771
|
+
resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => PromiseOrNot<string[]>;
|
|
754
772
|
};
|
|
755
773
|
/**
|
|
756
774
|
* @private
|
|
@@ -800,7 +818,9 @@ declare function useRoomContextBundle(): {
|
|
|
800
818
|
}) => _liveblocks_core.ThreadData<BaseMetadata>;
|
|
801
819
|
useEditThreadMetadata: () => (options: {
|
|
802
820
|
threadId: string;
|
|
803
|
-
metadata:
|
|
821
|
+
metadata: {
|
|
822
|
+
[x: string]: string | number | boolean | null | undefined;
|
|
823
|
+
};
|
|
804
824
|
}) => void;
|
|
805
825
|
useCreateComment: () => (options: CreateCommentOptions) => CommentData;
|
|
806
826
|
useEditComment: () => (options: EditCommentOptions) => void;
|
|
@@ -1154,7 +1174,9 @@ declare function useRoomContextBundle(): {
|
|
|
1154
1174
|
}) => _liveblocks_core.ThreadData<BaseMetadata>;
|
|
1155
1175
|
useEditThreadMetadata: () => (options: {
|
|
1156
1176
|
threadId: string;
|
|
1157
|
-
metadata:
|
|
1177
|
+
metadata: {
|
|
1178
|
+
[x: string]: string | number | boolean | null | undefined;
|
|
1179
|
+
};
|
|
1158
1180
|
}) => void;
|
|
1159
1181
|
useCreateComment: () => (options: CreateCommentOptions) => CommentData;
|
|
1160
1182
|
useEditComment: () => (options: EditCommentOptions) => void;
|
|
@@ -1471,4 +1493,4 @@ declare function useRoomContextBundle(): {
|
|
|
1471
1493
|
};
|
|
1472
1494
|
declare function createRoomContext<TPresence extends JsonObject, TStorage extends LsonObject = LsonObject, TUserMeta extends BaseUserMeta = BaseUserMeta, TRoomEvent extends Json = never, TThreadMetadata extends BaseMetadata = never>(client: Client, options?: Options<TUserMeta>): RoomContextBundle<TPresence, TStorage, TUserMeta, TRoomEvent, TThreadMetadata>;
|
|
1473
1495
|
|
|
1474
|
-
export { ClientSideSuspense, MutationContext,
|
|
1496
|
+
export { ClientSideSuspense, MutationContext, ResolveMentionSuggestionsArgs, ResolveUsersArgs, createRoomContext, useRoomContextBundle };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ declare type Props = {
|
|
|
28
28
|
*/
|
|
29
29
|
declare function ClientSideSuspense(props: Props): ReactElement;
|
|
30
30
|
|
|
31
|
+
declare type PartialNullable<T> = {
|
|
32
|
+
[P in keyof T]?: T[P] | null | undefined;
|
|
33
|
+
};
|
|
31
34
|
declare type CreateThreadOptions<TMetadata extends BaseMetadata> = [
|
|
32
35
|
TMetadata
|
|
33
36
|
] extends [never] ? {
|
|
@@ -42,7 +45,7 @@ declare type EditThreadMetadataOptions<TMetadata extends BaseMetadata> = [
|
|
|
42
45
|
threadId: string;
|
|
43
46
|
} : {
|
|
44
47
|
threadId: string;
|
|
45
|
-
metadata:
|
|
48
|
+
metadata: Resolve<PartialNullable<TMetadata>>;
|
|
46
49
|
};
|
|
47
50
|
declare type CreateCommentOptions = {
|
|
48
51
|
threadId: string;
|
|
@@ -79,11 +82,25 @@ declare type ThreadsStateSuccess<TThreadMetadata extends BaseMetadata> = {
|
|
|
79
82
|
};
|
|
80
83
|
declare type ThreadsState<TThreadMetadata extends BaseMetadata> = ThreadsStateLoading | ThreadsStateError | ThreadsStateSuccess<TThreadMetadata>;
|
|
81
84
|
|
|
82
|
-
declare type
|
|
83
|
-
|
|
85
|
+
declare type PromiseOrNot<T> = T | Promise<T>;
|
|
86
|
+
declare type ResolveUsersArgs = {
|
|
87
|
+
/**
|
|
88
|
+
* The ID of the current room.
|
|
89
|
+
*/
|
|
90
|
+
roomId: string;
|
|
91
|
+
/**
|
|
92
|
+
* The ID of the users to resolve.
|
|
93
|
+
*/
|
|
94
|
+
userIds: string;
|
|
84
95
|
};
|
|
85
|
-
declare type
|
|
96
|
+
declare type ResolveMentionSuggestionsArgs = {
|
|
97
|
+
/**
|
|
98
|
+
* The ID of the current room.
|
|
99
|
+
*/
|
|
86
100
|
roomId: string;
|
|
101
|
+
/**
|
|
102
|
+
* The text to search for.
|
|
103
|
+
*/
|
|
87
104
|
text: string;
|
|
88
105
|
};
|
|
89
106
|
declare type UserStateLoading = {
|
|
@@ -439,6 +456,7 @@ declare type RoomContextBundleShared<TPresence extends JsonObject, TStorage exte
|
|
|
439
456
|
* @beta
|
|
440
457
|
*
|
|
441
458
|
* Returns a function that edits a thread's metadata.
|
|
459
|
+
* To delete an existing metadata property, set its value to `null`.
|
|
442
460
|
*
|
|
443
461
|
* @example
|
|
444
462
|
* const editThreadMetadata = useEditThreadMetadata();
|
|
@@ -742,15 +760,15 @@ declare type Options<TUserMeta extends BaseUserMeta> = {
|
|
|
742
760
|
/**
|
|
743
761
|
* @beta
|
|
744
762
|
*
|
|
745
|
-
*
|
|
763
|
+
* A function that returns user info from user IDs.
|
|
746
764
|
*/
|
|
747
|
-
|
|
765
|
+
resolveUsers?: (args: ResolveUsersArgs) => PromiseOrNot<TUserMeta["info"] | undefined>;
|
|
748
766
|
/**
|
|
749
767
|
* @beta
|
|
750
768
|
*
|
|
751
|
-
*
|
|
769
|
+
* A function that returns a list of user IDs matching a string.
|
|
752
770
|
*/
|
|
753
|
-
resolveMentionSuggestions?: (
|
|
771
|
+
resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => PromiseOrNot<string[]>;
|
|
754
772
|
};
|
|
755
773
|
/**
|
|
756
774
|
* @private
|
|
@@ -800,7 +818,9 @@ declare function useRoomContextBundle(): {
|
|
|
800
818
|
}) => _liveblocks_core.ThreadData<BaseMetadata>;
|
|
801
819
|
useEditThreadMetadata: () => (options: {
|
|
802
820
|
threadId: string;
|
|
803
|
-
metadata:
|
|
821
|
+
metadata: {
|
|
822
|
+
[x: string]: string | number | boolean | null | undefined;
|
|
823
|
+
};
|
|
804
824
|
}) => void;
|
|
805
825
|
useCreateComment: () => (options: CreateCommentOptions) => CommentData;
|
|
806
826
|
useEditComment: () => (options: EditCommentOptions) => void;
|
|
@@ -1154,7 +1174,9 @@ declare function useRoomContextBundle(): {
|
|
|
1154
1174
|
}) => _liveblocks_core.ThreadData<BaseMetadata>;
|
|
1155
1175
|
useEditThreadMetadata: () => (options: {
|
|
1156
1176
|
threadId: string;
|
|
1157
|
-
metadata:
|
|
1177
|
+
metadata: {
|
|
1178
|
+
[x: string]: string | number | boolean | null | undefined;
|
|
1179
|
+
};
|
|
1158
1180
|
}) => void;
|
|
1159
1181
|
useCreateComment: () => (options: CreateCommentOptions) => CommentData;
|
|
1160
1182
|
useEditComment: () => (options: EditCommentOptions) => void;
|
|
@@ -1471,4 +1493,4 @@ declare function useRoomContextBundle(): {
|
|
|
1471
1493
|
};
|
|
1472
1494
|
declare function createRoomContext<TPresence extends JsonObject, TStorage extends LsonObject = LsonObject, TUserMeta extends BaseUserMeta = BaseUserMeta, TRoomEvent extends Json = never, TThreadMetadata extends BaseMetadata = never>(client: Client, options?: Options<TUserMeta>): RoomContextBundle<TPresence, TStorage, TUserMeta, TRoomEvent, TThreadMetadata>;
|
|
1473
1495
|
|
|
1474
|
-
export { ClientSideSuspense, MutationContext,
|
|
1496
|
+
export { ClientSideSuspense, MutationContext, ResolveMentionSuggestionsArgs, ResolveUsersArgs, createRoomContext, useRoomContextBundle };
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var _core = require('@liveblocks/core');
|
|
|
5
5
|
|
|
6
6
|
// src/version.ts
|
|
7
7
|
var PKG_NAME = "@liveblocks/react";
|
|
8
|
-
var PKG_VERSION = "1.4.
|
|
8
|
+
var PKG_VERSION = "1.4.6-test1";
|
|
9
9
|
var PKG_FORMAT = "cjs";
|
|
10
10
|
|
|
11
11
|
// src/ClientSideSuspense.tsx
|
|
@@ -28,6 +28,7 @@ var _client = require('@liveblocks/client');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
|
|
31
32
|
var _withselectorjs = require('use-sync-external-store/shim/with-selector.js');
|
|
32
33
|
|
|
33
34
|
// src/comments/CommentsRoom.ts
|
|
@@ -626,18 +627,6 @@ function useDebounce(value, delay = DEFAULT_DELAY) {
|
|
|
626
627
|
return debouncedValue;
|
|
627
628
|
}
|
|
628
629
|
|
|
629
|
-
// src/lib/stable-stringify.ts
|
|
630
|
-
function stableStringify(object, ...args) {
|
|
631
|
-
const sortedObject = Object.keys(object).sort().reduce(
|
|
632
|
-
(sortedObject2, key) => {
|
|
633
|
-
sortedObject2[key] = object[key];
|
|
634
|
-
return sortedObject2;
|
|
635
|
-
},
|
|
636
|
-
{}
|
|
637
|
-
);
|
|
638
|
-
return JSON.stringify(sortedObject, ...args);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
630
|
// src/lib/use-async-cache.ts
|
|
642
631
|
|
|
643
632
|
|
|
@@ -662,35 +651,50 @@ function useAsyncCache(cache, key, options) {
|
|
|
662
651
|
if (key === null || !cache) {
|
|
663
652
|
return null;
|
|
664
653
|
}
|
|
665
|
-
const cacheItem2 = cache.create(key
|
|
654
|
+
const cacheItem2 = cache.create(key);
|
|
666
655
|
void cacheItem2.get();
|
|
667
656
|
return cacheItem2;
|
|
668
|
-
}, [cache,
|
|
657
|
+
}, [cache, key]);
|
|
669
658
|
const subscribe = _react.useCallback.call(void 0,
|
|
670
|
-
(callback) => _nullishCoalesce(_optionalChain([cacheItem, 'optionalAccess',
|
|
659
|
+
(callback) => _nullishCoalesce(_optionalChain([cacheItem, 'optionalAccess', _2 => _2.subscribe, 'call', _3 => _3(callback)]), () => ( noop)),
|
|
671
660
|
[cacheItem]
|
|
672
661
|
);
|
|
673
662
|
const getState = _react.useCallback.call(void 0,
|
|
674
|
-
() => _nullishCoalesce(_optionalChain([cacheItem, 'optionalAccess',
|
|
663
|
+
() => _nullishCoalesce(_optionalChain([cacheItem, 'optionalAccess', _4 => _4.getState, 'call', _5 => _5()]), () => ( INITIAL_ASYNC_STATE)),
|
|
675
664
|
[cacheItem]
|
|
676
665
|
);
|
|
677
|
-
const revalidate = _react.useCallback.call(void 0, () => _optionalChain([cacheItem, 'optionalAccess',
|
|
666
|
+
const revalidate = _react.useCallback.call(void 0, () => _optionalChain([cacheItem, 'optionalAccess', _6 => _6.revalidate, 'call', _7 => _7()]), [cacheItem]);
|
|
678
667
|
const state = _indexjs.useSyncExternalStore.call(void 0, subscribe, getState, getState);
|
|
679
668
|
const previousData = _react.useRef.call(void 0, );
|
|
680
669
|
let data = state.data;
|
|
681
670
|
_react.useEffect.call(void 0, () => {
|
|
682
671
|
previousData.current = { key, data: state.data };
|
|
683
|
-
}, [key, state]);
|
|
684
|
-
if (
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
672
|
+
}, [key, state.data]);
|
|
673
|
+
if (!cacheItem) {
|
|
674
|
+
return {
|
|
675
|
+
isLoading: false,
|
|
676
|
+
data: void 0,
|
|
677
|
+
error: void 0,
|
|
678
|
+
getState,
|
|
679
|
+
revalidate
|
|
680
|
+
};
|
|
688
681
|
}
|
|
689
|
-
if (
|
|
690
|
-
|
|
682
|
+
if (_optionalChain([frozenOptions, 'optionalAccess', _8 => _8.suspense])) {
|
|
683
|
+
const error = getState().error;
|
|
684
|
+
if (error) {
|
|
685
|
+
throw error;
|
|
686
|
+
} else if (getState().isLoading) {
|
|
687
|
+
throw new Promise((resolve) => {
|
|
688
|
+
cacheItem.subscribeOnce((state2) => {
|
|
689
|
+
if (!state2.isLoading) {
|
|
690
|
+
resolve();
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
});
|
|
694
|
+
}
|
|
691
695
|
}
|
|
692
|
-
if (_optionalChain([frozenOptions, 'optionalAccess',
|
|
693
|
-
|
|
696
|
+
if (state.isLoading && _optionalChain([frozenOptions, 'optionalAccess', _9 => _9.keepPreviousDataWhileLoading]) && typeof state.data === "undefined" && _optionalChain([previousData, 'access', _10 => _10.current, 'optionalAccess', _11 => _11.key]) !== key && typeof _optionalChain([previousData, 'access', _12 => _12.current, 'optionalAccess', _13 => _13.data]) !== "undefined") {
|
|
697
|
+
data = previousData.current.data;
|
|
694
698
|
}
|
|
695
699
|
return {
|
|
696
700
|
isLoading: state.isLoading,
|
|
@@ -740,6 +744,9 @@ function alwaysEmptyList() {
|
|
|
740
744
|
function alwaysNull() {
|
|
741
745
|
return null;
|
|
742
746
|
}
|
|
747
|
+
function alwaysConnecting() {
|
|
748
|
+
return "connecting";
|
|
749
|
+
}
|
|
743
750
|
function makeMutationContext(room) {
|
|
744
751
|
const errmsg = "This mutation cannot be used until connected to the Liveblocks room";
|
|
745
752
|
return {
|
|
@@ -767,13 +774,13 @@ function makeMutationContext(room) {
|
|
|
767
774
|
setMyPresence: room.updatePresence
|
|
768
775
|
};
|
|
769
776
|
}
|
|
770
|
-
var
|
|
771
|
-
function
|
|
772
|
-
if (!
|
|
777
|
+
var hasWarnedIfNoResolveUsers = false;
|
|
778
|
+
function warnIfNoResolveUsers(usersCache) {
|
|
779
|
+
if (!hasWarnedIfNoResolveUsers && !usersCache && process.env.NODE_ENV !== "production") {
|
|
773
780
|
console.warn(
|
|
774
|
-
"Set the
|
|
781
|
+
"Set the resolveUsers option in createRoomContext to specify user info."
|
|
775
782
|
);
|
|
776
|
-
|
|
783
|
+
hasWarnedIfNoResolveUsers = true;
|
|
777
784
|
}
|
|
778
785
|
}
|
|
779
786
|
var hasWarnedAboutCommentsBeta = false;
|
|
@@ -878,7 +885,8 @@ function createRoomContext(client, options) {
|
|
|
878
885
|
const room = useRoom();
|
|
879
886
|
const subscribe = room.events.status.subscribe;
|
|
880
887
|
const getSnapshot = room.getStatus;
|
|
881
|
-
|
|
888
|
+
const getServerSnapshot = alwaysConnecting;
|
|
889
|
+
return useSyncExternalStore3(subscribe, getSnapshot, getServerSnapshot);
|
|
882
890
|
}
|
|
883
891
|
function useMyPresence() {
|
|
884
892
|
const room = useRoom();
|
|
@@ -1070,7 +1078,7 @@ function createRoomContext(client, options) {
|
|
|
1070
1078
|
function onRootChange() {
|
|
1071
1079
|
const newValue = root.get(key);
|
|
1072
1080
|
if (newValue !== curr) {
|
|
1073
|
-
_optionalChain([unsubCurr, 'optionalCall',
|
|
1081
|
+
_optionalChain([unsubCurr, 'optionalCall', _14 => _14()]);
|
|
1074
1082
|
curr = newValue;
|
|
1075
1083
|
subscribeToCurr();
|
|
1076
1084
|
rerender();
|
|
@@ -1081,7 +1089,7 @@ function createRoomContext(client, options) {
|
|
|
1081
1089
|
const unsubscribeRoot = room.subscribe(root, onRootChange);
|
|
1082
1090
|
return () => {
|
|
1083
1091
|
unsubscribeRoot();
|
|
1084
|
-
_optionalChain([unsubCurr, 'optionalCall',
|
|
1092
|
+
_optionalChain([unsubCurr, 'optionalCall', _15 => _15()]);
|
|
1085
1093
|
};
|
|
1086
1094
|
}, [rootOrNull, room, key, rerender]);
|
|
1087
1095
|
if (rootOrNull === null) {
|
|
@@ -1143,6 +1151,7 @@ function createRoomContext(client, options) {
|
|
|
1143
1151
|
}
|
|
1144
1152
|
ensureNotServerSide();
|
|
1145
1153
|
throw new Promise((res) => {
|
|
1154
|
+
room.events.self.subscribeOnce(() => res());
|
|
1146
1155
|
room.events.status.subscribeOnce(() => res());
|
|
1147
1156
|
});
|
|
1148
1157
|
}
|
|
@@ -1298,19 +1307,21 @@ function createRoomContext(client, options) {
|
|
|
1298
1307
|
[room]
|
|
1299
1308
|
);
|
|
1300
1309
|
}
|
|
1301
|
-
const {
|
|
1302
|
-
const usersCache =
|
|
1303
|
-
|
|
1310
|
+
const { resolveUsers, resolveMentionSuggestions } = _nullishCoalesce(options, () => ( {}));
|
|
1311
|
+
const usersCache = resolveUsers ? _core.createAsyncCache.call(void 0, async (stringifiedOptions) => {
|
|
1312
|
+
const users = await resolveUsers(
|
|
1304
1313
|
JSON.parse(stringifiedOptions)
|
|
1305
1314
|
);
|
|
1315
|
+
return _optionalChain([users, 'optionalAccess', _16 => _16[0]]);
|
|
1306
1316
|
}) : void 0;
|
|
1307
1317
|
function useUser(userId) {
|
|
1318
|
+
const room = useRoom();
|
|
1308
1319
|
const resolverKey = React2.useMemo(
|
|
1309
|
-
() =>
|
|
1310
|
-
[userId]
|
|
1320
|
+
() => _core.stringify.call(void 0, { userIds: [userId], roomId: room.id }),
|
|
1321
|
+
[userId, room.id]
|
|
1311
1322
|
);
|
|
1312
1323
|
const state = useAsyncCache(usersCache, resolverKey);
|
|
1313
|
-
React2.useEffect(() =>
|
|
1324
|
+
React2.useEffect(() => warnIfNoResolveUsers(usersCache), []);
|
|
1314
1325
|
if (state.isLoading) {
|
|
1315
1326
|
return {
|
|
1316
1327
|
isLoading: true
|
|
@@ -1324,14 +1335,15 @@ function createRoomContext(client, options) {
|
|
|
1324
1335
|
}
|
|
1325
1336
|
}
|
|
1326
1337
|
function useUserSuspense(userId) {
|
|
1338
|
+
const room = useRoom();
|
|
1327
1339
|
const resolverKey = React2.useMemo(
|
|
1328
|
-
() =>
|
|
1329
|
-
[userId]
|
|
1340
|
+
() => _core.stringify.call(void 0, { userIds: [userId], roomId: room.id }),
|
|
1341
|
+
[userId, room.id]
|
|
1330
1342
|
);
|
|
1331
1343
|
const state = useAsyncCache(usersCache, resolverKey, {
|
|
1332
1344
|
suspense: true
|
|
1333
1345
|
});
|
|
1334
|
-
React2.useEffect(() =>
|
|
1346
|
+
React2.useEffect(() => warnIfNoResolveUsers(usersCache), []);
|
|
1335
1347
|
return {
|
|
1336
1348
|
user: state.data,
|
|
1337
1349
|
isLoading: false
|
|
@@ -1348,7 +1360,7 @@ function createRoomContext(client, options) {
|
|
|
1348
1360
|
const room = useRoom();
|
|
1349
1361
|
const debouncedSearch = useDebounce(search, 500);
|
|
1350
1362
|
const resolverKey = React2.useMemo(
|
|
1351
|
-
() => debouncedSearch !== void 0 ?
|
|
1363
|
+
() => debouncedSearch !== void 0 ? _core.stringify.call(void 0, { text: debouncedSearch, roomId: room.id }) : null,
|
|
1352
1364
|
[debouncedSearch, room.id]
|
|
1353
1365
|
);
|
|
1354
1366
|
const { data } = useAsyncCache(mentionSuggestionsCache, resolverKey, {
|