Repository navigation
perf: stop keyboard events from re-rendering components that only read the keyboard state in callbacks - #106758
Conversation
…d the keyboard state in callbacks
|
@MelvinBot review |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
🤖 Web test steps verification results: Verified member filtering and multiline draft retention on dev NewDot web. Native keyboard behavior, web Shift+Enter, message editing, and JS-console cleanliness remain unverified.
|
|
@thesahindia Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
dylanexpensify
left a comment
There was a problem hiding this comment.
Product input not required for this PR.
|
@thesahindia kind bump |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-11-19.at.3.34.57.PM.movScreen.Recording.2026-11-19.at.3.36.51.PM.movAndroid: mWeb ChromeScreen.Recording.2026-11-19.at.3.41.04.PM.moviOS: HybridAppScreen.Recording.2026-11-19.at.4.04.10.PM.movScreen.Recording.2026-11-19.at.4.04.44.PM.moviOS: mWeb SafariScreen.Recording.2026-11-19.at.4.05.32.PM.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.53-0 🚀
|
|
No help site update needed — this PR optimizes keyboard-event rendering without changing user-facing workflows, UI labels, or behavior, so existing help articles remain accurate. |
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.5.53-3 🚀
Bundle Size Analysis (Sentry): |



Explanation of Change
KeyboardStateProviderupdates its context value on every keyboard event, 4 times per open/close. That re-renders everyuseKeyboardState()consumer, even when the consumer only readsisKeyboardShowninside a callback. The worst case is the WorkspacesTable: the Workspaces tab stays mounted while hidden, so all of its rows re-rendered on every keyboard event.This PR adds
useKeyboardShownRef(), a ref with a stable identity that the existing keyboard listeners update, and switches the callback-only readers to it:useScrollToFocusedInput, which letsTabledrop itsuseKeyboardState()subscriptionComposerWithSuggestionsConciergePromptBoxReportActionItemMessageEditBehaviour is unchanged: the ref is updated on the same events that set
isKeyboardShown.Dev build in the iOS simulator, measured with the React profiler using a 4×ABBA.
keyboard_before_after_side_by_side.mp4
Fixed Issues
$ #106763
PROPOSAL:
Tests
Scenario 1: Search bar in a table
Scenario 2: Enter key in composers
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Keyboard events are only on native
Android: Native
https://github.com/user-attachments/assets/eb81743e-a8af-4da2-9ec7-02266f705d46
https://github.com/user-attachments/assets/e4b32d78-5483-40d6-8944-ac9f9f001cf2
iOS: Native
https://github.com/user-attachments/assets/ec1260ff-fa1e-40e2-b7bf-78f44d628cdb
https://github.com/user-attachments/assets/02904e10-54dd-4e7d-92ae-2935703eda47