fix: Wrap navigation proxy using requestAnimationFrame#25241
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. |
…5240-fix-navigation-race-condition
…5240-fix-navigation-race-condition
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Impact Analysis:
Why this is high risk:
Recommended testing: Performance Test Selection: |
|



Description
The change wraps both
navigateandresetmethods from navigation withrequestAnimationFrameto ensure that it respects React's render cycles. This ensures that the navigation ref is being invoked with the latest context, which fixes race conditions associated with the navigation system not responding.Changelog
CHANGELOG entry:
Related issues
Fixes: #25240
Manual testing steps
Expected behavior
Screenshots/Recordings
Before
fail.mp4
After
fix.mp4
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Changes how
NavigationService.navigationbehaves by returning a Proxy that defersnavigate/reset, which can affect timing/order of navigation actions and introduces reliance onrequestAnimationFrame. Tests were expanded to cover deferred vs pass-through behavior, reducing regressions but still touching app-wide navigation flow.Overview
NavigationServicenow wraps the provided navigation ref in a Proxy that defersnavigateandresetcalls to the next frame viarequestAnimationFrame, aiming to avoid React render-cycle timing issues.Adds
resetForTesting()to clear the stored navigation ref, and expands the unit tests to validate deferred behavior fornavigate/resetplus pass-through/binding for other methods and properties.Written by Cursor Bugbot for commit f3eecc8. This will update automatically on new commits. Configure here.