feat: forward message loading feedback - show loader in header, disab…#6961
feat: forward message loading feedback - show loader in header, disab…#6961deepak0x wants to merge 2 commits intoRocketChat:developfrom
Conversation
…le channel selector and form while sending
WalkthroughAdds a Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ForwardView as ForwardMessageView
participant Select as SelectPersonOrChannel
participant Multi as MultiSelect
participant API as MessageAPI
User->>ForwardView: Tap Send
ForwardView->>ForwardView: set sending = true
ForwardView->>Select: set disabled = true
Select->>Multi: disabled = true (UI non-interactive)
ForwardView->>ForwardView: show ActivityIndicator
ForwardView->>API: sendForwardRequest(...)
API-->>ForwardView: success / error
ForwardView->>ForwardView: set sending = false (finally)
ForwardView->>Select: set disabled = false
ForwardView-->>User: update UI (success or alert)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
app/views/ForwardMessageView/index.tsx (2)
65-76:⚠️ Potential issue | 🟠 MajorEnsure
sendingresets even if permalink lookup fails.If
getPermalinkMessagethrows, the exception is uncaught andsetSending(false)never executes, leaving the UI permanently disabled. Move the permalink and message setup into thetryblock and add afinallyto guarantee state resets.🛠️ Suggested fix
const handlePostMessage = async () => { setSending(true); - const permalink = await getPermalinkMessage(message); - const msg = `[ ](${permalink})\n`; - try { + try { + const permalink = await getPermalinkMessage(message); + const msg = `[ ](${permalink})\n`; await Promise.all(rooms.map(roomId => postMessage(roomId, msg))); EventEmitter.emit(LISTENER, { message: I18n.t('Message_has_been_shared') }); navigation.dispatch(StackActions.pop()); } catch (e: any) { Alert.alert(I18n.t('Oops'), e.message); + } finally { + setSending(false); } - setSending(false); };
40-63:⚠️ Potential issue | 🟠 MajorInclude
roomsandcolorsin the dependency array.
Usingrooms.lengthinstead ofroomsfails to update the header when room selections change but maintain the same count (e.g., swapping from[roomA, roomB]to[roomB, roomC]). Additionally,colorsis referenced in the header callback but not included as a dependency, so theme changes won't trigger updates. Include bothroomsandcolorsto ensure the header action reflects the latest selection and theme.🔧 Minimal fix
- }, [rooms.length, navigation, sending]); + }, [rooms, navigation, sending, colors]);
Proposed Changes
This PR improves the user experience while forwarding a message by clearly showing the in-progress state and preventing interaction during the request.
ActivityIndicatorinstead of the Send button so users know the action is in progress.ScrollView) usespointerEvents='none'while sending, making the entire screen non-interactive until the request completes or fails.Issue(s)
Closes #6903
How to Test / Reproduce
Expected behavior:
Screenshots/Video
WhatsApp.Video.2026-02-03.at.08.38.20.mp4
Type of Change
Checklist
Summary by CodeRabbit