Skip to content

Commit

Permalink
use updateGroup instead of a separate query function
Browse files Browse the repository at this point in the history
  • Loading branch information
patosullivan committed Dec 5, 2024
1 parent 247818f commit 4ed12c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
6 changes: 3 additions & 3 deletions packages/app/features/top/ChannelScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export default function ChannelScreen(props: Props) {
if (group) {
// Update the last visited channel in the group so we can return to it
// when we come back to the group
db.updateLastVisitedChannelInGroup({
groupId: group.id,
channelId: channel.id,
db.updateGroup({
id: group.id,
lastVisitedChannelId: channel.id,
});
}
}
Expand Down
14 changes: 0 additions & 14 deletions packages/shared/src/db/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,20 +646,6 @@ export const deleteGroup = createWriteQuery(
['groups', 'channels']
);

export const updateLastVisitedChannelInGroup = createWriteQuery(
'updateLastVisitedChannelInGroup',
async (
{ groupId, channelId }: { groupId: string; channelId: string },
ctx: QueryCtx
) => {
return ctx.db
.update($groups)
.set({ lastVisitedChannelId: channelId })
.where(eq($groups.id, groupId));
},
['groups']
);

export const insertUnjoinedGroups = createWriteQuery(
'insertUnjoinedGroups',
async (groups: Group[], ctx: QueryCtx) => {
Expand Down

0 comments on commit 4ed12c5

Please sign in to comment.