Skip to content

Commit c6b8f26

Browse files
committed
fix: own reactions
1 parent 38f5a5e commit c6b8f26

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

package/src/store/OfflineDB.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import {
2-
AbstractOfflineDB,
3-
GetAppSettingsType,
4-
StreamChat,
5-
UpsertAppSettingsType,
6-
} from 'stream-chat';
1+
import { AbstractOfflineDB, StreamChat } from 'stream-chat';
72
import type {
3+
GetAppSettingsType,
84
GetChannelsForQueryType,
95
GetChannelsType,
106
GetLastSyncedAtType,
7+
UpsertAppSettingsType,
118
UpsertUserSyncStatusType,
129
} from 'stream-chat';
1310

package/src/store/apis/getChannelMessages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const getChannelMessages = async ({
2525
const messageIds = messageRows.map(({ id }) => id);
2626

2727
// Populate the message reactions.
28-
const reactionRows = await selectReactionsForMessages(messageIds);
28+
const reactionRows = await selectReactionsForMessages(messageIds, null);
2929
const messageIdVsReactions: Record<string, TableRowJoinedUser<'reactions'>[]> = {};
3030
reactionRows.forEach((reaction) => {
3131
if (!messageIdVsReactions[reaction.messageId]) {

package/src/store/apis/queries/selectReactionsForMessages.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { TableRowJoinedUser } from '../../types';
1313
*/
1414
export const selectReactionsForMessages = async (
1515
messageIds: string[],
16-
limit: number = 25,
16+
limit: number | null = 25,
1717
filters?: Pick<ReactionFilters, 'type'>,
1818
sort?: ReactionSort,
1919
): Promise<TableRowJoinedUser<'reactions'>[]> => {
@@ -52,8 +52,8 @@ export const selectReactionsForMessages = async (
5252
ON b.id = a.userId
5353
WHERE a.messageId in (${questionMarks}) ${filters?.type ? `AND a.type = ?` : ''}
5454
${orderByClause}
55-
LIMIT ?`,
56-
[...messageIds, ...filterValue, limit],
55+
${limit ? 'LIMIT ?' : ''}`,
56+
[...messageIds, ...filterValue, ...(limit ? [limit] : [])],
5757
);
5858

5959
return result.map((r) => JSON.parse(r.value));

0 commit comments

Comments
 (0)