Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Transition Tracing] Add transition tracing transitions stack #24321

Merged
merged 1 commit into from Apr 9, 2022

Conversation

Copy link
Contributor

@lunaruan lunaruan commented Apr 8, 2022

Added a transitions stack for to keep track of which transitions are still happening for the current boundary.
* On the root, we will get all transitions that have been initiated for the corresponding lanes.
* Whenever we encounter a suspended boundary, we will add all transitions on the stack onto the boundary
* Whenever we encounter a boundary that just unsuspended, we will add all transitions on the boundary onto the stack
A transition will be considered complete when there are no boundaries that have the associated transition

@lunaruan lunaruan requested a review from acdlite Apr 8, 2022
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team labels Apr 8, 2022
}

pushTransition(workInProgress, prevCachePool, null);
Copy link
Member

@acdlite acdlite Apr 8, 2022

Choose a reason for hiding this comment

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

Nit: Add a comment here to remind us to consider how transitions should work for Offscreen. Like maybe at some point we'll need a way to attribute pre-rendering work to the transition that spawned it.

TODO: Consider if and how Offscreen pre-rendering should be attributed to the transition that spawned it

@sizebot
Copy link

@sizebot sizebot commented Apr 8, 2022

Comparing: 8dcedba...5ee6aaa

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 = 131.40 kB 131.40 kB = 41.98 kB 41.98 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 136.66 kB 136.66 kB = 43.51 kB 43.51 kB
facebook-www/ReactDOM-prod.classic.js = 433.62 kB 433.62 kB = 79.74 kB 79.74 kB
facebook-www/ReactDOM-prod.modern.js = 418.62 kB 418.62 kB = 77.38 kB 77.38 kB
facebook-www/ReactDOMForked-prod.classic.js = 433.62 kB 433.62 kB = 79.75 kB 79.75 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 5ee6aaa

@lunaruan lunaruan force-pushed the stack branch 2 times, most recently from ab27dd0 to 085e721 Compare Apr 8, 2022
@lunaruan lunaruan force-pushed the stack branch 2 times, most recently from 7fe33af to f8c9395 Compare Apr 8, 2022
@@ -3572,10 +3574,11 @@ function attemptEarlyBailoutIfNoScheduledUpdate(
case HostRoot:
pushHostRootContext(workInProgress);
const root: FiberRoot = workInProgress.stateNode;
pushRootTransition(workInProgress, root, renderLanes);
Copy link
Member

@acdlite acdlite Apr 8, 2022

Choose a reason for hiding this comment

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

Nit: the order of pushes in the begin phase needs to be the reverse of the pops in the complete phase.

It happens to not matter here because none of these functions read the current value before the next one pops, but it's a refactor hazard if we ever change them to do that.

So since the complete phase is:

  • popRootTransition
  • popCacheProvider

The begin phase needs to be:

  • pushCacheProvider
  • pushRootTransition

// transitions. Therefore, we want to lazily combine transitions. Instead of
// comparing the arrays of transitions when we combine them and storing them
// and filtering out the duplicates, we will instead store the unprocessed transitions
// in an array of arrays and actually filter them in the passive phase.
Copy link
Member

@acdlite acdlite Apr 8, 2022

Choose a reason for hiding this comment

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

Nit: it's just an array now, not an array of arrays

}

const currentTransitions = transitionStack.current;
Copy link
Member

@acdlite acdlite Apr 8, 2022

Choose a reason for hiding this comment

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

Nit: You can return this directly without the null check

@lunaruan lunaruan merged commit e0160d5 into facebook:main Apr 9, 2022
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants