perf: improve predict explore re-renders#30135
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. |
| const drawToken = buttonConfig.drawToken; | ||
|
|
||
| return ( | ||
| <Box twClassName="w-full mt-4"> |
There was a problem hiding this comment.
Simple perf - move into own component, where we can utilise useMemo/useCallback to prevent additional function creation on each render.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Impact assessment:
Risk is low because:
Performance Test Selection: |
|
Skipping E2E as known failure
|
|



Description
Reduce tab performance degredation in explore - optimise predict rerenders.
From 60+ renders to 2/3
Changelog
CHANGELOG entry: perf: improve predict explore re-renders
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
https://www.loom.com/share/96f8b59522674684a93076e6e8e7c4fc
After
https://www.loom.com/share/34bffb5bcb59430286dac312e660d11e
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 refactor focused on render performance: it only restructures how bet button press handlers are memoized and passed down, without changing pricing/market logic or external APIs.
Overview
Reduces re-renders in
PredictActionButtonsby extracting the OPEN-market bet button rendering into a newPredictBetButtonsContainerand memoizingonYesPress/onNoPresswithuseCallback(and the optionalonDrawPress).This keeps the bet button UI/props the same while avoiding new inline handler functions on each render.
Reviewed by Cursor Bugbot for commit 5dba77f. Bugbot is set up for automated code reviews on this repo. Configure here.