stream-chat-react 12.15.6 → 12.15.7
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/components/Channel/Channel.js +1 -0
- package/dist/components/ChannelList/hooks/useChannelListShape.js +3 -3
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/MessageList/VirtualizedMessageListComponents.d.ts +1 -1
- package/dist/components/MessageList/VirtualizedMessageListComponents.js +4 -0
- package/dist/index.browser.cjs +8 -5
- package/dist/index.browser.cjs.map +2 -2
- package/dist/index.node.cjs +8 -5
- package/dist/index.node.cjs.map +2 -2
- package/package.json +1 -1
|
@@ -72,6 +72,7 @@ const ChannelInner = (props) => {
|
|
|
72
72
|
...initialState,
|
|
73
73
|
hasMore: channel.state.messagePagination.hasPrev,
|
|
74
74
|
loading: !channel.initialized,
|
|
75
|
+
messages: channel.state.messages,
|
|
75
76
|
});
|
|
76
77
|
const jumpToMessageFromSearch = useSearchFocusedMessage();
|
|
77
78
|
const isMounted = useIsMounted();
|
|
@@ -163,13 +163,13 @@ export const useChannelListShapeDefaults = () => {
|
|
|
163
163
|
if (typeof customHandler === 'function') {
|
|
164
164
|
return customHandler(setChannels, event);
|
|
165
165
|
}
|
|
166
|
-
if (!event.
|
|
166
|
+
if (!event.channel_id && !event.channel_type) {
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
169
|
const channel = await getChannel({
|
|
170
170
|
client,
|
|
171
|
-
id: event.
|
|
172
|
-
type: event.
|
|
171
|
+
id: event.channel_id,
|
|
172
|
+
type: event.channel_type,
|
|
173
173
|
});
|
|
174
174
|
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
175
175
|
if (isChannelArchived(channel) && considerArchivedChannels && !filters.archived) {
|
|
@@ -24,7 +24,7 @@ export const useChat = ({ client, defaultLanguage = 'en', i18nInstance, initialN
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (!client)
|
|
26
26
|
return;
|
|
27
|
-
const version = "12.15.
|
|
27
|
+
const version = "12.15.7";
|
|
28
28
|
const userAgent = client.getUserAgent();
|
|
29
29
|
if (!userAgent.includes('stream-chat-react')) {
|
|
30
30
|
// result looks like: 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
|
|
@@ -12,6 +12,6 @@ type CommonVirtuosoComponentProps<StreamChatGenerics extends DefaultStreamChatGe
|
|
|
12
12
|
};
|
|
13
13
|
export declare const Item: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ context, ...props }: ItemProps & CommonVirtuosoComponentProps<StreamChatGenerics>) => React.JSX.Element;
|
|
14
14
|
export declare const Header: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ context, }: CommonVirtuosoComponentProps<StreamChatGenerics>) => React.JSX.Element;
|
|
15
|
-
export declare const EmptyPlaceholder: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ context, }: CommonVirtuosoComponentProps<StreamChatGenerics>) => React.JSX.Element;
|
|
15
|
+
export declare const EmptyPlaceholder: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>({ context, }: CommonVirtuosoComponentProps<StreamChatGenerics>) => React.JSX.Element | null;
|
|
16
16
|
export declare const messageRenderer: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(virtuosoIndex: number, _data: UnknownType, virtuosoContext: VirtuosoContext<StreamChatGenerics>) => React.JSX.Element | null;
|
|
17
17
|
export {};
|
|
@@ -44,6 +44,10 @@ export const Header = ({ context, }) => {
|
|
|
44
44
|
};
|
|
45
45
|
export const EmptyPlaceholder = ({ context, }) => {
|
|
46
46
|
const { EmptyStateIndicator = DefaultEmptyStateIndicator } = useComponentContext('VirtualizedMessageList');
|
|
47
|
+
// prevent showing that there are no messages if there actually are messages (for some reason virtuoso decides to render empty placeholder first, even though it has the totalCount prop > 0)
|
|
48
|
+
if (typeof context?.processedMessages !== 'undefined' &&
|
|
49
|
+
context.processedMessages.length > 0)
|
|
50
|
+
return null;
|
|
47
51
|
return (React.createElement(React.Fragment, null, EmptyStateIndicator && (React.createElement(EmptyStateIndicator, { listType: context?.threadList ? 'thread' : 'message' }))));
|
|
48
52
|
};
|
|
49
53
|
export const messageRenderer = (virtuosoIndex, _data, virtuosoContext) => {
|
package/dist/index.browser.cjs
CHANGED
|
@@ -41965,13 +41965,13 @@ var useChannelListShapeDefaults = () => {
|
|
|
41965
41965
|
if (typeof customHandler === "function") {
|
|
41966
41966
|
return customHandler(setChannels, event);
|
|
41967
41967
|
}
|
|
41968
|
-
if (!event.
|
|
41968
|
+
if (!event.channel_id && !event.channel_type) {
|
|
41969
41969
|
return;
|
|
41970
41970
|
}
|
|
41971
41971
|
const channel = await getChannel({
|
|
41972
41972
|
client,
|
|
41973
|
-
id: event.
|
|
41974
|
-
type: event.
|
|
41973
|
+
id: event.channel_id,
|
|
41974
|
+
type: event.channel_type
|
|
41975
41975
|
});
|
|
41976
41976
|
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
41977
41977
|
if (isChannelArchived(channel) && considerArchivedChannels && !filters.archived) {
|
|
@@ -51466,6 +51466,8 @@ var EmptyPlaceholder = ({
|
|
|
51466
51466
|
context
|
|
51467
51467
|
}) => {
|
|
51468
51468
|
const { EmptyStateIndicator: EmptyStateIndicator2 = EmptyStateIndicator } = useComponentContext("VirtualizedMessageList");
|
|
51469
|
+
if (typeof context?.processedMessages !== "undefined" && context.processedMessages.length > 0)
|
|
51470
|
+
return null;
|
|
51469
51471
|
return /* @__PURE__ */ import_react257.default.createElement(import_react257.default.Fragment, null, EmptyStateIndicator2 && /* @__PURE__ */ import_react257.default.createElement(EmptyStateIndicator2, { listType: context?.threadList ? "thread" : "message" }));
|
|
51470
51472
|
};
|
|
51471
51473
|
var messageRenderer = (virtuosoIndex, _data, virtuosoContext) => {
|
|
@@ -52195,7 +52197,8 @@ var ChannelInner = (props) => {
|
|
|
52195
52197
|
{
|
|
52196
52198
|
...initialState,
|
|
52197
52199
|
hasMore: channel.state.messagePagination.hasPrev,
|
|
52198
|
-
loading: !channel.initialized
|
|
52200
|
+
loading: !channel.initialized,
|
|
52201
|
+
messages: channel.state.messages
|
|
52199
52202
|
}
|
|
52200
52203
|
);
|
|
52201
52204
|
const jumpToMessageFromSearch = useSearchFocusedMessage();
|
|
@@ -53127,7 +53130,7 @@ var useChat = ({
|
|
|
53127
53130
|
};
|
|
53128
53131
|
(0, import_react263.useEffect)(() => {
|
|
53129
53132
|
if (!client) return;
|
|
53130
|
-
const version = "12.15.
|
|
53133
|
+
const version = "12.15.7";
|
|
53131
53134
|
const userAgent = client.getUserAgent();
|
|
53132
53135
|
if (!userAgent.includes("stream-chat-react")) {
|
|
53133
53136
|
client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|