From e35adbce0e2f9ae9873bf668ae47448abd75591d Mon Sep 17 00:00:00 2001 From: Smriti Doneria Date: Sat, 2 Nov 2024 16:56:22 +0530 Subject: [PATCH 1/2] pin --- packages/react/src/views/Message/Message.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react/src/views/Message/Message.js b/packages/react/src/views/Message/Message.js index 8ce3d8bf5..df3373cd8 100644 --- a/packages/react/src/views/Message/Message.js +++ b/packages/react/src/views/Message/Message.js @@ -91,10 +91,13 @@ const Message = ({ const handlePinMessage = async (msg) => { const isPinned = msg.pinned; + // Optimistically update the UI + 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', From ccb8fcae88dc8c5be1f10e82ea9966f701c74c15 Mon Sep 17 00:00:00 2001 From: Smriti Doneria Date: Sat, 2 Nov 2024 23:27:19 +0530 Subject: [PATCH 2/2] removed comment --- packages/react/src/views/Message/Message.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react/src/views/Message/Message.js b/packages/react/src/views/Message/Message.js index df3373cd8..f2ed3df93 100644 --- a/packages/react/src/views/Message/Message.js +++ b/packages/react/src/views/Message/Message.js @@ -91,7 +91,6 @@ const Message = ({ const handlePinMessage = async (msg) => { const isPinned = msg.pinned; - // Optimistically update the UI msg.pinned = !isPinned; const pinOrUnpin = isPinned ? await RCInstance.unpinMessage(msg._id)