fix: stabilize useWithdrawalRequests selectors to prevent unnecessary re-renders#29597
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The change is scoped entirely to the Perps withdrawal requests hook, used only in PerpsProgressBar component. No interface changes, no API changes, no logic changes beyond the early-exit optimization. SmokePerps is selected as the primary tag since this directly affects Perps withdrawal functionality. Per the SmokePerps tag description, SmokeWalletPlatform (Trending section) and SmokeConfirmations (on-chain transactions) must also be selected. Performance Test Selection: |
|



Description
Inline
[]fallbacks inuseWithdrawalRequestsselectors were creating new array references on every render, triggering React-Redux's "Selector unknown returned a different result" warning and causing unnecessary re-renders inPerpsProgressBaron mount.Fixed by replacing inline
[]literals with module-level constants and short-circuiting.filter()on empty arrays so selectors always return the same reference.Performance impact: FPS on Perps tab mount improved from 60→22 drops down to a stable 60→57, nearly eliminating the frame drop entirely and it doesn't take ~1 second for the Perps screen to show anymore
NOTE: Unrelated to these changes, there is a considerate amount of frame drop when you're on the Perps home screen and from the UI hydrating. The frames drop as low as 8 FPS. This happens in
mainand this branch as well. Might be worth a follow up ticketChangelog
CHANGELOG entry:null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Simulator.Screen.Recording.-.iPhone.17.-.2026-04-30.at.16.09.38.mov
Before
Simulator.Screen.Recording.-.iPhone.17.-.2026-04-30.at.16.05.29.mov
After
Simulator.Screen.Recording.-.iPhone.17.-.2026-04-30.at.16.09.38.mov
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Low risk performance-only change: replaces inline empty-array fallbacks with stable module constants to avoid React-Redux selector warnings and unnecessary re-renders; no business logic or API behavior changes expected.
Overview
Prevents unnecessary re-renders in
useWithdrawalRequestsby replacing inline[]selector fallbacks with module-levelEMPTY_WITHDRAWAL_REQUESTS/EMPTY_TX_HASHESconstants and short-circuiting the withdrawal.filter()when there’s no selected address or the list is empty.This makes selector outputs stable across renders (eliminating the “selector returned a different result” warning) while keeping the displayed/polled withdrawal logic unchanged.
Reviewed by Cursor Bugbot for commit e020446. Bugbot is set up for automated code reviews on this repo. Configure here.