Skip to content

Commit

Permalink
db: handle channel membership changes to live-update unjoined channels
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesacklin committed Nov 22, 2024
1 parent 6126f08 commit 252ee99
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/shared/src/db/changeListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,12 @@ export function handleChange({
queryKey: ['post', row.thread_id],
});
}

// Handle channel membership changes
if (table === 'channels' && row) {
// If currentUserIsMember changed, invalidate unjoined channels query
queryClient.invalidateQueries({
queryKey: ['unjoinedChannels', row.group_id],
});
}
}

0 comments on commit 252ee99

Please sign in to comment.