Skip to content

Commit

Permalink
Fix UI Not Updating Immediately After Pinning/Unpinning Messages (Roc…
Browse files Browse the repository at this point in the history
…ketChat#654)

* pin

* removed comment
  • Loading branch information
smritidoneria authored and SinghaAnirban005 committed Jan 1, 2025
1 parent 990084f commit ed4b244
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/react/src/views/Message/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ const Message = ({

const handlePinMessage = async (msg) => {
const isPinned = msg.pinned;
msg.pinned = !isPinned;
const pinOrUnpin = isPinned
? await RCInstance.unpinMessage(msg._id)
: await RCInstance.pinMessage(msg._id);
if (pinOrUnpin.error) {
msg.pinned = isPinned;
dispatchToastMessage({
type: 'error',
message: 'Error pinning message',
Expand Down

0 comments on commit ed4b244

Please sign in to comment.