Skip to content

Commit

Permalink
Fix channel/channelId, group/groupId related type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
patosullivan committed Jan 15, 2025
1 parent 9e24383 commit 6fac5a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/app/features/top/ActivityScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
9 changes: 6 additions & 3 deletions packages/app/features/top/ChannelScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default function ChannelScreen(props: Props) {

const [channelNavOpen, setChannelNavOpen] = React.useState(false);
const [inviteSheetGroup, setInviteSheetGroup] =
React.useState<db.Group | null>();
React.useState<string | null>();

// for the unread channel divider, we care about the unread state when you enter but don't want it to update over
// time
Expand Down Expand Up @@ -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]);

Expand Down Expand Up @@ -430,7 +433,7 @@ export default function ChannelScreen(props: Props) {
open={inviteSheetGroup !== null}
onOpenChange={handleInviteSheetOpenChange}
onInviteComplete={() => setInviteSheetGroup(null)}
group={inviteSheetGroup ?? undefined}
groupId={inviteSheetGroup ?? undefined}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6fac5a7

Please sign in to comment.