Skip to content

Commit

Permalink
fix query invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-rajpal committed Oct 29, 2024
1 parent 4324bab commit 5cd1e97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/meteor/client/startup/actionButtons/starMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ Meteor.startup(() => {
try {
await sdk.rest.post('/v1/chat.starMessage', { messageId: message._id });
starMessage(message, true);
queryClient.invalidateQueries(['rooms', message.rid, 'starred-messages']);
} catch (error) {
if (error) {
dispatchToastMessage({ type: 'error', message: error });
}
} finally {
queryClient.invalidateQueries(['rooms', message.rid, 'starred-messages']);
}
},
condition({ message, subscription, user, room }) {
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/client/startup/actionButtons/unstarMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ Meteor.startup(() => {
try {
await sdk.rest.post('/v1/chat.unStarMessage', { messageId: message._id });
starMessage(message, false);
queryClient.invalidateQueries(['rooms', message.rid, 'starred-messages']);
} catch (error) {
dispatchToastMessage({ type: 'error', message: error });
} finally {
queryClient.invalidateQueries(['rooms', message.rid, 'starred-messages']);
}
},
condition({ message, subscription, user }) {
Expand Down

0 comments on commit 5cd1e97

Please sign in to comment.