stream-chat-react-native-core 9.11.0 → 9.11.1-beta.2
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/lib/commonjs/components/MessageList/MessageFlashList.js +38 -6
- package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +16 -4
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/store/apis/getChannelMessages.js +5 -3
- package/lib/commonjs/store/apis/getChannelMessages.js.map +1 -1
- package/lib/commonjs/store/apis/getChannels.js +6 -3
- package/lib/commonjs/store/apis/getChannels.js.map +1 -1
- package/lib/commonjs/store/apis/getChannelsForFilterSort.js +2 -1
- package/lib/commonjs/store/apis/getChannelsForFilterSort.js.map +1 -1
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js +7 -5
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/MessageList/MessageFlashList.js +38 -6
- package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +16 -4
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/store/apis/getChannelMessages.js +5 -3
- package/lib/module/store/apis/getChannelMessages.js.map +1 -1
- package/lib/module/store/apis/getChannels.js +6 -3
- package/lib/module/store/apis/getChannels.js.map +1 -1
- package/lib/module/store/apis/getChannelsForFilterSort.js +2 -1
- package/lib/module/store/apis/getChannelsForFilterSort.js.map +1 -1
- package/lib/module/store/apis/queries/selectMessagesForChannels.js +7 -5
- package/lib/module/store/apis/queries/selectMessagesForChannels.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/MessageList/MessageFlashList.d.ts +1 -1
- package/lib/typescript/components/MessageList/MessageFlashList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/store/apis/getChannelMessages.d.ts +2 -1
- package/lib/typescript/store/apis/getChannelMessages.d.ts.map +1 -1
- package/lib/typescript/store/apis/getChannels.d.ts +3 -1
- package/lib/typescript/store/apis/getChannels.d.ts.map +1 -1
- package/lib/typescript/store/apis/getChannelsForFilterSort.d.ts.map +1 -1
- package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts +3 -1
- package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/MessageList/MessageFlashList.tsx +58 -8
- package/src/components/MessageList/MessageList.tsx +22 -5
- package/src/components/MessageList/__tests__/MessageList.test.tsx +51 -0
- package/src/store/__tests__/selectMessagesForChannels.test.ts +63 -0
- package/src/store/apis/getChannelMessages.ts +4 -1
- package/src/store/apis/getChannels.ts +5 -1
- package/src/store/apis/getChannelsForFilterSort.ts +1 -0
- package/src/store/apis/queries/selectMessagesForChannels.ts +7 -2
- package/src/version.json +1 -1
|
@@ -2,8 +2,12 @@ import { tables } from '../../schema';
|
|
|
2
2
|
import { SqliteClient } from '../../SqliteClient';
|
|
3
3
|
import type { TableRowJoinedUser } from '../../types';
|
|
4
4
|
|
|
5
|
+
/** The `message_limit` the client assumes for a channel list query that sets none. */
|
|
6
|
+
export const DEFAULT_CHANNEL_LIST_MESSAGE_LIMIT = 25;
|
|
7
|
+
|
|
5
8
|
export const selectMessagesForChannels = async (
|
|
6
9
|
cids: string[],
|
|
10
|
+
messageLimit: number = DEFAULT_CHANNEL_LIST_MESSAGE_LIMIT,
|
|
7
11
|
): Promise<TableRowJoinedUser<'messages'>[]> => {
|
|
8
12
|
const questionMarks = Array(cids.length).fill('?').join(',');
|
|
9
13
|
const messagesColumnNames = Object.keys(tables.messages.columns)
|
|
@@ -15,6 +19,7 @@ export const selectMessagesForChannels = async (
|
|
|
15
19
|
|
|
16
20
|
SqliteClient.logger?.('info', 'selectMessagesForChannels', {
|
|
17
21
|
cids,
|
|
22
|
+
messageLimit,
|
|
18
23
|
});
|
|
19
24
|
|
|
20
25
|
const result = await SqliteClient.executeSql(
|
|
@@ -38,9 +43,9 @@ export const selectMessagesForChannels = async (
|
|
|
38
43
|
LEFT JOIN
|
|
39
44
|
users b
|
|
40
45
|
ON b.id = a.userId
|
|
41
|
-
WHERE RowNum
|
|
46
|
+
WHERE RowNum <= ?
|
|
42
47
|
ORDER BY a.createdAt ASC`,
|
|
43
|
-
cids,
|
|
48
|
+
[...cids, messageLimit],
|
|
44
49
|
);
|
|
45
50
|
|
|
46
51
|
return result.map((r) => JSON.parse(r.value));
|
package/src/version.json
CHANGED