GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [DevTools][Transition Tracing] onTransitionComplete and onTransitionStart implmentation by lunaruan · Pull Request #23313 · react/react

Conversation

@lunaruan

@lunaruan lunaruan commented Feb 16, 2022

Copy link
Copy Markdown
Contributor

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 16, 2022
@sizebot

sizebot commented Feb 16, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 68cb55f...47800dc

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js +0.05% 131.26 kB 131.33 kB +0.05% 41.99 kB 42.01 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.03% 136.12 kB 136.16 kB +0.03% 43.42 kB 43.43 kB
facebook-www/ReactDOM-prod.classic.js +0.01% 434.31 kB 434.37 kB +0.01% 79.42 kB 79.43 kB
facebook-www/ReactDOM-prod.modern.js +0.01% 424.09 kB 424.16 kB +0.02% 77.98 kB 77.99 kB
facebook-www/ReactDOMForked-prod.classic.js +0.01% 434.31 kB 434.37 kB +0.01% 79.42 kB 79.43 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 47800dc

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lunaruan
lunaruan force-pushed the onTransitionComplete branch 4 times, most recently from 54457ae to 2d2b5de Compare February 16, 2022 22:18
acdlite
acdlite reviewed Feb 17, 2022
View reviewed changes
Comment thread packages/react-noop-renderer/src/createReactNoop.js Outdated
callbacks: TransitionTracingCallbacks,
): void {
const endTime = Scheduler.unstable_now();
Scheduler.unstable_scheduleCallback(Scheduler.unstable_IdlePriority, () =>

@acdlite acdlite Feb 17, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the only thing this does is call Scheduler, we might as well call Scheduler directly from the reconciler instead of going through the host config. We can add a host config once it becomes necessary.

Same for getCurrentEventStartTime, I think. Just call Scheduler.unstable_now for now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lunaruan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread packages/react/src/ReactCurrentBatchConfig.js Outdated
type BatchConfig = {
transition: number,
_updatedFibers?: Set<Fiber>,
transitionInfo: Transition | null,

@acdlite acdlite Feb 17, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's combine this with the transition field. We don't use the number for anything currently, we just check if it's set with currentBatchConfig.transition === 0. We can update those to currentBatchConfig.transition === null instead.

Then in all those places where you temporarily unset both transition and transitionInfo, you only need to unset a single field.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lunaruan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
acdlite
acdlite reviewed Feb 17, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Outdated
if (enableTransitionTracing) {
switch (finishedWork.tag) {
case HostRoot: {
const currentTransitions = getTransitionsForLanes(root, lanes);

@acdlite acdlite Feb 17, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same as current.state.transitions?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lunaruan lunaruan Feb 17, 2022

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we wnat to log this in startTransition later?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lunaruan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
acdlite
acdlite reviewed Feb 17, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Outdated
case ScopeComponent:
case OffscreenComponent:
case LegacyHiddenComponent:
case TracingMarkerComponent: {

@acdlite acdlite Feb 17, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still some TracingMarkerComponent stuff in here that we don't need yet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lunaruan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
lunaruan
lunaruan commented Feb 17, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/__tests__/ReactTransitionTracing-test.js Outdated
beforeEach(() => {
jest.resetModules();
const ReactFeatureFlags = require('shared/ReactFeatureFlags');
ReactFeatureFlags.enableTransitionTracing = true;

@lunaruan lunaruan Feb 17, 2022

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write in a way where you can test using the actual compiled bundles

// @gate enableTransitionTracing

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lunaruan lunaruan Feb 17, 2022

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReactFeatureFlags.www-dynamic -> put flags there

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lunaruan
lunaruan force-pushed the onTransitionComplete branch 3 times, most recently from 448f013 to e72a310 Compare February 18, 2022 04:27
acdlite
acdlite reviewed Feb 23, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberBeginWork.old.js Outdated
pushRootCachePool(root);
}
if (enableTransitionTracing) {
workInProgress.memoizedState.transitions = getTransitionsForLanes(

@acdlite acdlite Feb 23, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why this loopy lane thing is necessary but it's a bit unfortunate. I think the ideal is that we'd have only a single loopy lane thing at the very beginning of the render phase. So, the loop that does entanglement stuff that currently happens in getNextLanes should be the same loop that creates this transition set, too. This will require some refactoring that is outside the scope of this PR, but we should try to align with that overall structure.

So, maybe you could move this getTransitionsForLanes call to the place in renderRootConcurrent and renderRootSync that calls prepareFreshStack:

https://github.com/facebook/react/blob/40351575d3cfaef62426c889a90431c01fdeff0f/packages/react-reconciler/src/ReactFiberWorkLoop.new.js#L1692-L1710

That block is the entry point into every new render phase. You would store the transitions in a work loop variable, something like workInProgressTransitions.

Later we can refactor to combine all the loopy lane stuff into a single loopy lane loop.

Then, in this function here, you would call getWorkInProgressTransitions, which does nothing except read the work loop variable.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
acdlite
acdlite reviewed Feb 23, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Outdated
case HostRoot: {
const state = finishedWork.memoizedState;
const transitions = state.transitions;
if (transitions != null) {

@acdlite acdlite Feb 23, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: !== null

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lunaruan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
acdlite
acdlite reviewed Feb 23, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberRoot.new.js Outdated
export type RootState = {
element: any,
cache?: Cache | null,
transitions?: Transitions | null,

@acdlite acdlite Feb 23, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just make both of these fields required. No ?, just Cache | null and Transitions | null. That way the value is never undefined.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lunaruan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
acdlite
acdlite reviewed Feb 23, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberRoot.new.js Outdated
this.transitionCallbacks = null;
const transitionLanesMap = (this.transitionLanes = []);
for (let i = 0; i < TotalLanes; i++) {
transitionLanesMap.push(new Set());

@acdlite acdlite Feb 23, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should initialize to null, not an empty set

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lunaruan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
acdlite
acdlite reviewed Feb 23, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberTracingMarkerComponent.new.js Outdated
_updatedFibers?: Set<Fiber>,
};

export type Transitions = Set<Transition> | null;

@acdlite acdlite Feb 23, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be an array instead of a Set? The total size is usually 1, maybe 2 or 3 sometimes, right?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lunaruan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
acdlite
acdlite reviewed Feb 23, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberTracingMarkerComponent.old.js Outdated
type: TransitionCallback,
transitionName: string,
startTime: number,
markerName?: string,

@acdlite acdlite Feb 23, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these optional fields? They should always exist, or be null.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lunaruan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
acdlite
acdlite reviewed Feb 23, 2022
View reviewed changes
Comment thread packages/react-reconciler/src/ReactFiberCommitWork.new.js Outdated
transitions.forEach(transition => {
// TODO(luna) Do we want to log TransitionStart in the startTransition callback instead?
addCallbackToPendingTransitionCallbacks({
type: TransitionStart,

@acdlite acdlite Feb 23, 2022

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this type field necessary? Why do you know it's a start callback here but not later?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lunaruan lunaruan Feb 24, 2022

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's so we know when/what to call the startTransitionCallback with. Do you recommend we do this some other way?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
acdlite
acdlite approved these changes Feb 24, 2022
View reviewed changes
@lunaruan
lunaruan force-pushed the onTransitionComplete branch from 18877f5 to de2bddc Compare February 24, 2022 22:16
lunaruan added 7 commits February 24, 2022 17:18
@lunaruan
add transition name to startTransition
8b2d306
Add a transitionName to start transition, store the transition start time and name in the batch config, and pass it to the root on render
@lunaruan
Transition Tracing Types and Consts
7fb60be
@lunaruan
Root begin work
72ffad3
The root operates as a tracing marker that has all transitions on it. This PR only tested the root with one transition so far

- Store transitions in memoizedState. Do this in updateHostRoot AND attemptEarlyBailoutIfNoScheduledUpdate. We need to do this in the latter part because even if the root itself doesn't have an update, it could still have new transitions in its transitionLanes map that we need to process.
@lunaruan
Transition Tracing commit phase
03c1d2a
- adds a module scoped pending transition callbacks object that contains all transition callbacks that have not yet been processed. This  contains all callbacks before the next paint occurs.
- Add code in the mutation phase to:
        * For the root, if there are transitions that were initialized during this commit in the root transition lanes map, add a transition start call to the pending transition callbacks object. Then, remove the transitions from the root transition lanes map.
        * For roots, in the commit phase, add a transition complete call

We add this code in the mutation phase because we can't add it to the passive phase because then the paint might have occurred before we even know which callbacks to call
@lunaruan
Process Callbacks after paint
1694a48
At the end of the commit phase, call scheduleTransitionCallbacks to schedule all pending transition callbacks to be called after paint. Then clear the callbacks
@lunaruan
test
bf13715
@lunaruan
fix lint errors
3b123ad
lunaruan added 2 commits February 24, 2022 17:18
@lunaruan
old fork
a550e7f
@lunaruan
addressed comments
47800dc
@lunaruan
lunaruan force-pushed the onTransitionComplete branch from de2bddc to 47800dc Compare February 24, 2022 22:18
@lunaruan
lunaruan merged commit 42f15b3 into react:main Feb 24, 2022
facebook-github-bot pushed a commit to react/react-native that referenced this pull request Mar 1, 2022
@kacieb @facebook-github-bot
React Native sync for revisions 4de99b3...1780659
6a4e905
Summary:
This sync includes the following changes:
- **[1780659](react/react@17806594c )**: Move createRoot/hydrateRoot to react-dom/client ([#23385](react/react#23385)) //<Sebastian Markbåge>//
- **[75662d6](react/react@75662d6a7 )**: Remove hacky stream.locked check, declare as byte stream instead ([#23387](react/react#23387)) //<Sebastian Markbåge>//
- **[a82ef6d](react/react@a82ef6d40 )**: Add back skipUnmountedBoundaries flag only for www ([#23383](react/react#23383)) //<Andrew Clark>//
- **[f468816](react/react@f468816ef )**: Fix false positive hydration warnings ([#23364](react/react#23364)) //<Andrew Clark>//
- **[5d08a24](react/react@5d08a24c2 )**: useId: Use 'H' to separate main id from hook index ([#23363](react/react#23363)) //<Andrew Clark>//
- **[3a60844](react/react@3a60844a0 )**: Update error message for suspending at sync priority ([#23361](react/react#23361)) //<Andrew Clark>//
- **[efe4121](react/react@efe4121ee )**: Add : to beginning and end of every useId ([#23360](react/react#23360)) //<Andrew Clark>//
- **[42f15b3](react/react@42f15b324 )**: [DevTools][Transition Tracing] onTransitionComplete and onTransitionStart implmentation ([#23313](react/react#23313)) //<Luna Ruan>//
- **[a5b2215](react/react@a5b22155c )**: Warn if renderSubtreeIntoContainer is called ([#23355](react/react#23355)) //<Andrew Clark>//
- **[52c393b](react/react@52c393b5d )**: Revert to client render on text mismatch ([#23354](react/react#23354)) //<Andrew Clark>//
- **[1ad8d81](react/react@1ad8d8129 )**: Remove object-assign polyfill ([#23351](react/react#23351)) //<Sebastian Markbåge>//
- **[b3f3da2](react/react@b3f3da205 )**: Land warnOnSubscriptionInsideStartTransition flag ([#23353](react/react#23353)) //<Andrew Clark>//
- **[990098f](react/react@990098f88 )**: Re-arrange main ReactFeatureFlags module ([#23350](react/react#23350)) //<Andrew Clark>//
- **[1f3f6db](react/react@1f3f6db73 )**: Remove createMutableSource from stable exports ([#23352](react/react#23352)) //<Andrew Clark>//
- **[587e759](react/react@587e75930 )**: Remove Numeric Fallback of Symbols ([#23348](react/react#23348)) //<Sebastian Markbåge>//
- **[4035157](react/react@40351575d )**: Split writeChunk into void and return value ([#23343](react/react#23343)) //<Sebastian Markbåge>//
- **[2c693b2](react/react@2c693b2de )**: Re-add reentrancy avoidance ([#23342](react/react#23342)) //<Sebastian Markbåge>//
- **[1760b27](react/react@1760b27c0 )**: Remove ./src/* export from public build ([#23262](react/react#23262)) //<Andrew Clark>//
- **[552c067](react/react@552c067bb )**: Remove public export for unstable-shared-subset.js ([#23261](react/react#23261)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 4de99b3...1780659

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D34552175

fbshipit-source-id: f1c831a45f96d335a20c3b4113196e0a42cefc03
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Apr 15, 2022
@lunaruan @zhengjitf
[DevTools][Transition Tracing] onTransitionComplete and onTransitionS…
4aa3ae9
…tart implmentation (react#23313)

* add transition name to startTransition

Add a transitionName to start transition, store the transition start time and name in the batch config, and pass it to the root on render

* Transition Tracing Types and Consts

* Root begin work

The root operates as a tracing marker that has all transitions on it. This PR only tested the root with one transition so far

- Store transitions in memoizedState. Do this in updateHostRoot AND attemptEarlyBailoutIfNoScheduledUpdate. We need to do this in the latter part because even if the root itself doesn't have an update, it could still have new transitions in its transitionLanes map that we need to process.

* Transition Tracing commit phase

- adds a module scoped pending transition callbacks object that contains all transition callbacks that have not yet been processed. This  contains all callbacks before the next paint occurs.
- Add code in the mutation phase to:
        * For the root, if there are transitions that were initialized during this commit in the root transition lanes map, add a transition start call to the pending transition callbacks object. Then, remove the transitions from the root transition lanes map.
        * For roots, in the commit phase, add a transition complete call

We add this code in the mutation phase because we can't add it to the passive phase because then the paint might have occurred before we even know which callbacks to call

* Process Callbacks after paint

At the end of the commit phase, call scheduleTransitionCallbacks to schedule all pending transition callbacks to be called after paint. Then clear the callbacks
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2023
@kacieb @Saadnajmi
React Native sync for revisions 4de99b3...1780659
cde01ad
Summary:
This sync includes the following changes:
- **[1780659](react/react@17806594c )**: Move createRoot/hydrateRoot to react-dom/client ([react#23385](react/react#23385)) //<Sebastian Markbåge>//
- **[75662d6](react/react@75662d6a7 )**: Remove hacky stream.locked check, declare as byte stream instead ([react#23387](react/react#23387)) //<Sebastian Markbåge>//
- **[a82ef6d](react/react@a82ef6d40 )**: Add back skipUnmountedBoundaries flag only for www ([react#23383](react/react#23383)) //<Andrew Clark>//
- **[f468816](react/react@f468816ef )**: Fix false positive hydration warnings ([react#23364](react/react#23364)) //<Andrew Clark>//
- **[5d08a24](react/react@5d08a24c2 )**: useId: Use 'H' to separate main id from hook index ([react#23363](react/react#23363)) //<Andrew Clark>//
- **[3a60844](react/react@3a60844a0 )**: Update error message for suspending at sync priority ([react#23361](react/react#23361)) //<Andrew Clark>//
- **[efe4121](react/react@efe4121ee )**: Add : to beginning and end of every useId ([react#23360](react/react#23360)) //<Andrew Clark>//
- **[42f15b3](react/react@42f15b324 )**: [DevTools][Transition Tracing] onTransitionComplete and onTransitionStart implmentation ([react#23313](react/react#23313)) //<Luna Ruan>//
- **[a5b2215](react/react@a5b22155c )**: Warn if renderSubtreeIntoContainer is called ([react#23355](react/react#23355)) //<Andrew Clark>//
- **[52c393b](react/react@52c393b5d )**: Revert to client render on text mismatch ([react#23354](react/react#23354)) //<Andrew Clark>//
- **[1ad8d81](react/react@1ad8d8129 )**: Remove object-assign polyfill ([react#23351](react/react#23351)) //<Sebastian Markbåge>//
- **[b3f3da2](react/react@b3f3da205 )**: Land warnOnSubscriptionInsideStartTransition flag ([react#23353](react/react#23353)) //<Andrew Clark>//
- **[990098f](react/react@990098f88 )**: Re-arrange main ReactFeatureFlags module ([react#23350](react/react#23350)) //<Andrew Clark>//
- **[1f3f6db](react/react@1f3f6db73 )**: Remove createMutableSource from stable exports ([react#23352](react/react#23352)) //<Andrew Clark>//
- **[587e759](react/react@587e75930 )**: Remove Numeric Fallback of Symbols ([react#23348](react/react#23348)) //<Sebastian Markbåge>//
- **[4035157](react/react@40351575d )**: Split writeChunk into void and return value ([react#23343](react/react#23343)) //<Sebastian Markbåge>//
- **[2c693b2](react/react@2c693b2de )**: Re-add reentrancy avoidance ([react#23342](react/react#23342)) //<Sebastian Markbåge>//
- **[1760b27](react/react@1760b27c0 )**: Remove ./src/* export from public build ([react#23262](react/react#23262)) //<Andrew Clark>//
- **[552c067](react/react@552c067bb )**: Remove public export for unstable-shared-subset.js ([react#23261](react/react#23261)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 4de99b3...1780659

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D34552175

fbshipit-source-id: f1c831a45f96d335a20c3b4113196e0a42cefc03
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@lunaruan
[DevTools][Transition Tracing] onTransitionComplete and onTransitionS…
517aeba
…tart implmentation (react#23313)

* add transition name to startTransition

Add a transitionName to start transition, store the transition start time and name in the batch config, and pass it to the root on render

* Transition Tracing Types and Consts

* Root begin work

The root operates as a tracing marker that has all transitions on it. This PR only tested the root with one transition so far

- Store transitions in memoizedState. Do this in updateHostRoot AND attemptEarlyBailoutIfNoScheduledUpdate. We need to do this in the latter part because even if the root itself doesn't have an update, it could still have new transitions in its transitionLanes map that we need to process.

* Transition Tracing commit phase

- adds a module scoped pending transition callbacks object that contains all transition callbacks that have not yet been processed. This  contains all callbacks before the next paint occurs.
- Add code in the mutation phase to:
        * For the root, if there are transitions that were initialized during this commit in the root transition lanes map, add a transition start call to the pending transition callbacks object. Then, remove the transitions from the root transition lanes map.
        * For roots, in the commit phase, add a transition complete call

We add this code in the mutation phase because we can't add it to the passive phase because then the paint might have occurred before we even know which callbacks to call

* Process Callbacks after paint

At the end of the commit phase, call scheduleTransitionCallbacks to schedule all pending transition callbacks to be called after paint. Then clear the callbacks
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@lunaruan
[DevTools][Transition Tracing] onTransitionComplete and onTransitionS…
f20507c
…tart implmentation (react#23313)

* add transition name to startTransition

Add a transitionName to start transition, store the transition start time and name in the batch config, and pass it to the root on render

* Transition Tracing Types and Consts

* Root begin work

The root operates as a tracing marker that has all transitions on it. This PR only tested the root with one transition so far

- Store transitions in memoizedState. Do this in updateHostRoot AND attemptEarlyBailoutIfNoScheduledUpdate. We need to do this in the latter part because even if the root itself doesn't have an update, it could still have new transitions in its transitionLanes map that we need to process.

* Transition Tracing commit phase

- adds a module scoped pending transition callbacks object that contains all transition callbacks that have not yet been processed. This  contains all callbacks before the next paint occurs.
- Add code in the mutation phase to:
        * For the root, if there are transitions that were initialized during this commit in the root transition lanes map, add a transition start call to the pending transition callbacks object. Then, remove the transitions from the root transition lanes map.
        * For roots, in the commit phase, add a transition complete call

We add this code in the mutation phase because we can't add it to the passive phase because then the paint might have occurred before we even know which callbacks to call

* Process Callbacks after paint

At the end of the commit phase, call scheduleTransitionCallbacks to schedule all pending transition callbacks to be called after paint. Then clear the callbacks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@acdlite acdlite acdlite approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@lunaruan @sizebot @acdlite @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.