Skip to content

fix: initialize transition start time with performance.now()#35726

Open
subhamkumarr wants to merge 2 commits intofacebook:mainfrom
subhamkumarr:fix-transition-tracing-timestamp
Open

fix: initialize transition start time with performance.now()#35726
subhamkumarr wants to merge 2 commits intofacebook:mainfrom
subhamkumarr:fix-transition-tracing-timestamp

Conversation

@subhamkumarr
Copy link

Details

  • packages/react/src/ReactStartTransition.js: Added a now() helper (using performance.now() with a Date.now() fallback) and used it to set currentTransition.startTime.
  • packages/react-reconciler/src/ReactFiberWorkLoop.js: Removed the check for transition.startTime === -1 and the subsequent assignment, as it is no longer needed.

Motivation

Previously, startTime was initialized to -1 and lazily updated upon scheduling an update. This behavior was inconsistent with useTransition and could lead to inaccurate timestamps if there was a delay between the transition start and the actual update scheduling. This change standardizes the behavior and ensures accurate timing for transition tracing.

How to Test

  1. Enable enableTransitionTracing feature flag.
  2. Run yarn test ReactTransitionTracing.
  3. Verify that tests pass and that transition start times are reasonable (non-negative).

Checklist

  • Tests passed locally (yarn test ReactTransitionTracing).
  • I have addressed the TODOs in the codebase.

Fixes #35725

@meta-cla
Copy link

meta-cla bot commented Feb 8, 2026

Hi @subhamkumarr!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Feb 8, 2026
@subhamkumarr
Copy link
Author

@hoxyq @unstubbable @jackpope
could you please review this and merge it when you get a chance? Thanks!
Fixes #35725

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Initialize transition start time in startTransition and startGestureTransition

1 participant