refactor: performance, recording consistency, and quote logic fixes#1108
Closed
vivekyadav-3 wants to merge 1 commit intoRocketChat:developfrom
Closed
refactor: performance, recording consistency, and quote logic fixes#1108vivekyadav-3 wants to merge 1 commit intoRocketChat:developfrom
vivekyadav-3 wants to merge 1 commit intoRocketChat:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR optimizes performance and fixes consistency issues in the recording functionality and permission handling.
Changes:
- Fixed a typo (
toogleRecordingMessage→toggleRecordingMessage) and integrated video recording state management to match audio recording behavior - Optimized permission memoization to prevent unnecessary re-renders
- Improved role processing performance from O(N²) to O(N) and added null-safety to admin username mapping
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/react/src/views/ChatInput/VideoMessageRecoder.js | Added toggleRecordingMessage calls to synchronize global recording state, ensuring UI elements are properly disabled during video recording |
| packages/react/src/views/ChatInput/AudioMessageRecorder.js | Fixed typo in function name from toogleRecordingMessage to toggleRecordingMessage |
| packages/react/src/store/messageStore.js | Fixed typo in store method name from toogleRecordingMessage to toggleRecordingMessage |
| packages/react/src/hooks/useFetchChatData.js | Fixed permission memoization by storing raw permissions, optimized roles reduce from O(N²) to O(N), and added null-safety for admin usernames mapping |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6d87022 to
d0c6bb1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rawpermission object was missing its reference point.2.Efficiency: The member role reduction logic was using an immutable spread pattern inside a reduce, leading to O(N^2) complexity.
isRecordingMessagestate, allowing users to still interact with the chat input while recording.toogleRecordingMessage) led to inconsistencies across hooks.Solution
permissionsRef.current.rawto ensure the early-exit logic works, preventing redundant state updates.roles.reducelogic for O(N) performance.Testing
npm run build).