Verified Solution

[facebook/react] Bug: Initialize transition start time in startTransition and startGestureTransition

Sponsored Content
### ROOT CAUSE The `currentTransition.startTime` is incorrectly initialized to `-1` in `startTransition` and `startGestureTransition` functions. Instead of capturing the immediate timestamp, it relies on a lazy initialization that doesn't reflect the actual start time. This causes the timestamp to be inaccurate, especially when transitions are created but updates are processed later. ### CODE FIX 1. **Modify `ReactStartTransition.js` to set `startTime` immediately:** ```javascript function startTransition( callback: () => void, priority?: TransitionPriority, ): Transition { // Initialize startTime with current timestamp const startTime = typeof performance !== 'undefined' && performance.now ? performance.now() : Date.now(); // ... rest of the code using startTime } function startGestureTransition( callback: () => void, ): Transition { // Initialize startTime with current timestamp const startTime = typeof performance !== 'undefined' && performance.now ? performance.now() : Date.now(); // ... rest of the code using startTime } ``` 2. **Remove lazy initialization from `ReactFiberWorkLoop.js`:** ```javascript // Remove or comment out the code that sets startTime lazily ``` ### Explanation - **Immediate Timestamp Capture:** By initializing `startTime` directly in `startTransition` and `startGestureTransition`, we ensure the timestamp reflects when the transition started. - **Fallback Mechanism:** Using `performance.now()` for high precision and falling back to `Date.now()` ensures compatibility across environments. - **Lazy Initialization Removal:** Eliminating the delayed timestamp assignment prevents discrepancies between the actual transition start and when the timestamp is recorded.
Deploy on DigitalOcean ($200 Credit)

Related Fixes

[StackOverflow/reactjs] change Emmet abbreviation ".." from 'styleName' to 'className'
[microsoft/vscode] Iteration Plan for February 2026 [DRAFT]
[gitlab-org/gitlab] Remove OKRs