From 6fac5a7cd9dcc6f85c542941b40fc6ad6f59246a Mon Sep 17 00:00:00 2001 From: Patrick O'Sullivan Date: Wed, 15 Jan 2025 08:06:48 -0600 Subject: [PATCH] Fix channel/channelId, group/groupId related type issues --- packages/app/features/top/ActivityScreen.tsx | 2 +- packages/app/features/top/ChannelScreen.tsx | 9 ++++++--- .../src/components/ListItem/InteractableChatListItem.tsx | 7 +++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/app/features/top/ActivityScreen.tsx b/packages/app/features/top/ActivityScreen.tsx index 5953075a4f..18406dfe4e 100644 --- a/packages/app/features/top/ActivityScreen.tsx +++ b/packages/app/features/top/ActivityScreen.tsx @@ -56,7 +56,7 @@ export function ActivityScreen(props: Props) { const handleGoToGroup = useCallback( (group: db.Group) => { - store.markGroupRead(group); + store.markGroupRead(group.id); props.navigation.navigate('GroupSettings', { screen: 'GroupMembers', params: { groupId: group.id }, diff --git a/packages/app/features/top/ChannelScreen.tsx b/packages/app/features/top/ChannelScreen.tsx index 682fdddecd..ff95ff243e 100644 --- a/packages/app/features/top/ChannelScreen.tsx +++ b/packages/app/features/top/ChannelScreen.tsx @@ -106,7 +106,7 @@ export default function ChannelScreen(props: Props) { const [channelNavOpen, setChannelNavOpen] = React.useState(false); const [inviteSheetGroup, setInviteSheetGroup] = - React.useState(); + React.useState(); // for the unread channel divider, we care about the unread state when you enter but don't want it to update over // time @@ -336,7 +336,10 @@ export default function ChannelScreen(props: Props) { const handleMarkRead = useCallback(async () => { if (channel && !channel.isPendingChannel) { - store.markChannelRead(channel); + store.markChannelRead({ + id: channel.id, + groupId: channel.groupId ?? undefined, + }); } }, [channel]); @@ -430,7 +433,7 @@ export default function ChannelScreen(props: Props) { open={inviteSheetGroup !== null} onOpenChange={handleInviteSheetOpenChange} onInviteComplete={() => setInviteSheetGroup(null)} - group={inviteSheetGroup ?? undefined} + groupId={inviteSheetGroup ?? undefined} /> )} diff --git a/packages/ui/src/components/ListItem/InteractableChatListItem.tsx b/packages/ui/src/components/ListItem/InteractableChatListItem.tsx index d4178aee92..3a81ae05d8 100644 --- a/packages/ui/src/components/ListItem/InteractableChatListItem.tsx +++ b/packages/ui/src/components/ListItem/InteractableChatListItem.tsx @@ -62,9 +62,12 @@ function BaseInteractableChatRow({ break; case 'markRead': if (model.type === 'group') { - store.markGroupRead(model.group, true); + store.markGroupRead(model.id, true); } else { - store.markChannelRead(model.channel); + store.markChannelRead({ + id: model.id, + groupId: model.channel.groupId ?? undefined, + }); } break; default: