On the native platforms (specifically observed on Android), scrolling to and highlighting a newly added expense is inconsistent. This race condition exists on main but has become more apparent following recent performance-focused changes.
Current Behavior
The search highlight flow is currently timer-based.
- After submitting an expense outside of the Inbox, the new transaction is marked for highlight on the Search route.
- This highlight state is cleared after a fixed timeout.
- The actual scroll/highlight action triggers only after the Search list has mounted, data is grouped/sorted, and the list layout callback runs.
Problem
If Search rendering is delayed - due to navigation timing, loading skeletons, or heavy list processing - the highlight state often expires before the row is reachable. This results in the expense neither being scrolled into view nor highlighted.
Proposed solution
We need to move away from a timeout-based lifecycle and implement a readiness-based approach.
- Persist state: Maintain the manual highlight state/flag until the target transaction is confirmed to be present in the rendered Search data.
- Trigger on readiness: Only execute the scroll and highlight once the list is layout-ready and the specific item exists in the DOM/list index.
- Explicit cleanup: Clear the highlight flag only after the scroll/highlight animation has successfully initiated.
Impact
- Consistency: Ensures the "Add Expense" flow always provides visual confirmation of the new entry, regardless of device performance or network latency.
- UX: Eliminates the "vanishing highlight" bug where the UI state resets before the user even sees the Search page.
Note
This was identified during a performance PR where the timing window became easier to hit, but the root cause is an architectural race condition in the Search highlight logic.
Observed here: #84910 (comment)
Issue Owner
Current Issue Owner: @borys3kk
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022034273899120343057
- Upwork Job ID: 2034273899120343057
- Last Price Increase: 2026-03-18
On the native platforms (specifically observed on Android), scrolling to and highlighting a newly added expense is inconsistent. This race condition exists on main but has become more apparent following recent performance-focused changes.
Current Behavior
The search highlight flow is currently timer-based.
Problem
If Search rendering is delayed - due to navigation timing, loading skeletons, or heavy list processing - the highlight state often expires before the row is reachable. This results in the expense neither being scrolled into view nor highlighted.
Proposed solution
We need to move away from a timeout-based lifecycle and implement a readiness-based approach.
Impact
Note
This was identified during a performance PR where the timing window became easier to hit, but the root cause is an architectural race condition in the Search highlight logic.
Observed here: #84910 (comment)
Issue Owner
Current Issue Owner: @borys3kkUpwork Automation - Do Not Edit