Files
react/scripts/merge-fork
Andrew Clark 1859329021 Track nearest Suspense handler on stack (#24585)
* [FORKED] Add HiddenContext to track if subtree is hidden

This adds a new stack cursor for tracking whether we're rendering inside
a subtree that's currently hidden.

This corresponds to the same place where we're already tracking the
"base lanes" needed to reveal a hidden subtree — that is, when going
from hidden -> visible, the base lanes are the ones that we skipped
over when we deferred the subtree. We must includes all the base lanes
and their updates in order to avoid an inconsistency with the
surrounding content that already committed.

I consolidated the base lanes logic and the hidden logic into the same
set of push/pop calls.

This is intended to replace the InvisibleParentContext that is currently
part of SuspenseContext, but I haven't done that part yet.

* Add previous commit to forked revisions

* [FORKED] Track nearest Suspense handler on stack

Instead of traversing the return path whenever something suspends to
find the nearest Suspense boundary, we can push the Suspense boundary
onto the stack before entering its subtree. This doesn't affect the
overall algorithm that much, but because we already do all the same
logic in the begin phase, we can save some redundant work by tracking
that information on the stack instead of recomputing it every time.

* Add previous commit to forked revisions
2022-06-30 10:03:29 -04:00
..

merge-fork

Script for syncing changes between forked modules.

Basic example

yarn merge-fork --base-dir=packages/react-reconciler/src ReactFiberWorkLoop

This will take all the changes in ReactFiberWorkLoop.new.js and apply them to ReactFiberWorkLoop.old.js.

Syncing multiple modules at once

You can merge multiple modules at a time:

yarn merge-fork \
  --base-dir=packages/react-reconciler/src \
  ReactFiberWorkLoop \
  ReactFiberBeginWork \
  ReactFiberCompleteWork \
  ReactFiberCommitWork

Syncing modules with different names

You can provide explicit "old" and "new" file names. This only works for one module at a time:

yarn merge-fork \
  --base-dir=packages/react-reconciler/src \
  --old=ReactFiberExpirationTime.js \
  --new=ReactFiberLane.js

Syncing modules in the opposite direction (old -> new)

The default is to merge changes from the new module to the old one. To merge changes in the opposite direction, use --reverse.

yarn merge-fork \
  --reverse \
  --base-dir=packages/react-reconciler/src \
  ReactFiberWorkLoop

Comparing changes to an older base rev

By default, the changes are compared to HEAD. You can use --base-ref to compare to any rev. For example, while working on a PR, you might make multiple commits to the new fork before you're ready to backport them to the old one. In that case, you want to compare to the merge base of your PR branch:

yarn merge-fork \
  --base-ref=$(git merge-base HEAD origin/main)
  --base-dir=packages/react-reconciler/src \
  ReactFiberWorkLoop