Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: facebook/react
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: be229c5655074642ee664f532f2e7411dd7dccc7
Choose a base ref
...
head repository: facebook/react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a87edf62d7d69705ddbcec9a24f0780b3db7535f
Choose a head ref

Commits on Jun 14, 2022

  1. [Transition Tracing] Fix Cache and Transitions Pop Order (#24719)

    We push the Cache before the transition so we should pop the transition before the cache. This PR fixes this issue.
    lunaruan authored Jun 14, 2022
    Copy the full SHA
    54f17e4 View commit details
  2. 1
    Copy the full SHA
    89bae8f View commit details
  3. Copy the full SHA
    5cc2487 View commit details
  4. Move renderToString tests out of the streamable API tests (#24724)

    ReactDOMFizzServer(Browser/Node)-test file is really meant to just be a
    very shallow tests of the Browser/Node specific streaming APIs.
    
    Most of the general streaming tests are in ReactDOMFizzServer-test instead
    of testing all streaming related things in each environment.
    
    The legacy renderToString APIs are mostly covered by ReactServerRendering-test
    et al for historical reasons.
    sebmarkbage authored Jun 14, 2022
    Copy the full SHA
    567500d View commit details
  5. Copy the full SHA
    6522179 View commit details
  6. Typo

    gaearon authored Jun 14, 2022
    1
    Copy the full SHA
    256aefb View commit details

Commits on Jun 15, 2022

  1. Move the Error creation to be lazy (#24728)

    Creating an Error captures a stack trace which can be somewhat expensive.
    We shouldn't do tthat always for every render.
    
    This also ensures that the stack trace is more useful because you can
    follow through the Node.js code to see the cause.
    sebmarkbage authored Jun 15, 2022
    Copy the full SHA
    522f473 View commit details
  2. [Transition Tracing] Push Transition When Offscreen Becomes Visible (#…

    …24718)
    
    This PR pushes all of a suspense boundary's transitions onto the transition stack when it goes from hidden to visible so we can pass it to any child suspense boundaries or tracing markers.
    lunaruan authored Jun 15, 2022
    Copy the full SHA
    fcd720d View commit details

Commits on Jun 16, 2022

  1. Bugfix: Offscreen instance is null during setState (#24734)

    * [FORKED] Bugfix: Offscreen instance is null during setState
    
    During a setState, we traverse up the return path and check if any
    parent Offscreen components are currently hidden. To do that, we must
    access the Offscreen fiber's `stateNode` field.
    
    On a mounted Offscreen fiber, the `stateNode` is never null, so usually
    we don't need to refine the type. When a fiber is unmounted, though,
    we null out its `stateNode` field to prevent memory cycles. However,
    we also null out its `return` field, so I had assumed that an unmounted
    Offscreen fiber would never be reachable.
    
    What I didn't consider is that it's possible to call `setState` on a
    fiber that never finished mounting. Because it never mounted, it was
    never deleted. Because it was never deleted, its `return` field was
    never disconnected.
    
    This pattern is always accompanied by a warning but we still need to
    account for it. There may also be other patterns where an unmounted
    Offscreen instance is reachable, too.
    
    The discovery also suggests it may be better for memory
    usage if we don't attach the `return` pointer until the commit phase,
    though in order to do that we'd need some other way to track the return
    pointer during initial render, like on the stack.
    
    The fix is to add a null check before reading the instance
    during setState.
    
    * Add previous commit to list of forked revisions
    acdlite authored Jun 16, 2022
    Copy the full SHA
    c3d7a7e View commit details
  2. Revert "Land enableClientRenderFallbackOnTextMismatch" (#24738)

    This reverts commit 327e4a1.
    
    Turns out we hadn't rolled this out internally yet — I mistook
    enableClientRenderFallbackOnHydrationMismatch for
    said enableClientRenderFallbackOnTextMismatch. Need to revert
    until we finish rolling out the change.
    acdlite authored Jun 16, 2022
    Copy the full SHA
    229c86a View commit details

Commits on Jun 17, 2022

  1. Copy the full SHA
    7cf9f5e View commit details
  2. Copy the full SHA
    a7c322c View commit details
  3. [DevTools] fix useDeferredValue to match reconciler change (#24742)

    * [DevTools] fix useDeferredValue to match reconciler change
    
    * fixup
    
    * update test to catch original issue
    
    * fix lint
    
    * add safer tests for other composite hooks
    mondaychen authored Jun 17, 2022
    Copy the full SHA
    72ebc70 View commit details
  4. [Transition Tracing] Add Support for Multiple Transitions on Root (#2…

    …4732)
    
    We can think of transitions on the root as a bunch of tracing markers. Therefore, we can map each transition to a map of pending suspense boundaries. When a transition's pending suspense boundary map is empty, we know that it's complete. This PR:
    * Combines the `pendingSuspenseBoundaries` and `transitions` into one `incompleteTransitions` object. This object is a map from a `transition` to a map of `pendingSuspenseBoundaries`
    * Refactored code to make it so that every transition has its own `pendingSuspenseBoundaries` map rather than sharing just one.
    * Moves the transition complete callback to the root. Alternatively, we can also keep a map of pendingSuspenseBoundaries to transitions on the Offscreen marker, but it's simpler to just call the transition complete callback on the root instead. We also only do this if there are transitions pending, so it shouldn't make too big of a difference
    lunaruan authored Jun 17, 2022
    Copy the full SHA
    12a738f View commit details

Commits on Jun 18, 2022

  1. Aborting early should not infinitely suspend (#24751)

    Before this change we weren't calling onError nor onFatalError if you abort
    before completing the shell.
    
    This means that the render never completes and hangs.
    
    Aborting early can happen before even creating the stream for AbortSignal,
    before rendering starts in Node since there's an setImmediate atm, or
    during rendering.
    sebmarkbage authored Jun 18, 2022
    Copy the full SHA
    0f0aca3 View commit details
  2. Rename Segment to Task in Flight (#24753)

    In Fizz this got split into Task and Segment. We don't have a concept of
    Segment in Flight yet because we don't inline multiple segments into one
    "Row". We just emit one "Row" for each Segment if something suspends.
    
    This makes Flight non-deterministic atm but that's something we'll want to
    address.
    
    Regardless, right now, this is more like a Task than a Segment.
    sebmarkbage authored Jun 18, 2022
    Copy the full SHA
    f796fa1 View commit details

Commits on Jun 19, 2022

  1. Add entry points for "static" server rendering passes (#24752)

    This will be used to add optimizations for static server rendering.
    sebmarkbage authored Jun 19, 2022
    Copy the full SHA
    0f216ae View commit details
  2. Abort Flight (#24754)

    Add aborting to the Flight Server. This encodes the reason as an "error"
    row that gets thrown client side. These are still exposed in prod which
    is a follow up we'll still have to do to encode them as digests instead.
    
    The error is encoded once and then referenced by each row that needs to
    be updated.
    sebmarkbage authored Jun 19, 2022
    Copy the full SHA
    56389e8 View commit details

Commits on Jun 20, 2022

  1. Copy the full SHA
    d6255f0 View commit details

Commits on Jun 21, 2022

  1. [DevTools] Refactor incompleteTransitions field from Root Fiber memoi…

    …zed state to FiberRoot (#24765)
    
    `incompleteTransitions` persists across renders, so it should be part of the `fiber.stateNode` (ie FiberRoot) rather than `fiber.memoizedState`
    lunaruan authored Jun 21, 2022
    Copy the full SHA
    cf665c4 View commit details

Commits on Jun 23, 2022

  1. [DevTools][Timeline Profiler] Component Stacks Backend (#24776)

    This PR adds a component stack field to the `schedule-state-update` event. The algorithm is as follows:
    * During profiling, whenever a state update happens collect the parents of the fiber that caused the state update and store it in a map
    * After profiling finishes, post process the `schedule-state-update` event and using the parent fibers, generate the component stack by using`describeFiber`, a function that uses error throwing to get the location of the component by calling the component without props.
    
    ---
    
    Co-authored-by: Blake Friedman <blake.friedman@gmail.com>
    lunaruan and blakef authored Jun 23, 2022
    Copy the full SHA
    9abe745 View commit details
  2. [DevTools] Clean Up DevTools Code (#24782)

    This PR cleans up the DevTools codebase by:
    * Consolidating `normalizeCodeLocInfo` into one place
    * Remove unused source argument in the DevTools component stacks code
    lunaruan authored Jun 23, 2022
    Copy the full SHA
    955cad9 View commit details

Commits on Jun 25, 2022

  1. [sizebot] Add link to diff view (#24790)

    Updates the sizebot output so that the file names link to a diff view of
    the corresponding build artifact.
    
    Example diff view: https://react-builds.vercel.app/commits/955cad9bcc6d755b2a672f8038fe9754e0fe5108/files/oss-stable-semver/react-dom/cjs/react-dom.production.min.js?compare=c3d7a7e3d72937443ef75b7e29335c98ad0f1424
    
    The diff view itself is rendered by a Next.js app that I built as a side
    project and is hosted at https://react-builds.vercel.app. If we find
    this useful enough I could move the app to a React-owned repo but since
    this isn't a critical feature it might be OK to leave it separate for
    now, so we don't need to commit to supporting it indefinitely.
    acdlite authored Jun 25, 2022
    Copy the full SHA
    652e6c5 View commit details

Commits on Jun 26, 2022

  1. fix hydration warning suppression in text comparisons (#24784)

    * fix hydration warning suppression in text comparisons
    
    * lint
    
    * lowercase test
    gnoff authored Jun 26, 2022
    Copy the full SHA
    1678530 View commit details

Commits on Jun 27, 2022

  1. [Transition Tracing] Add Tracing Markers (#24686)

    This PR adds support for Tracing Markers as well as onTracingMarkerComplete
    lunaruan authored Jun 27, 2022
    Copy the full SHA
    a4bed46 View commit details

Commits on Jun 28, 2022

  1. Fix enableTransitionTracing flag (#24801)

    Move `enableTransitionTracing` to `dynamicFeatureFlags` so it runs when you run `yarn test`
    lunaruan authored Jun 28, 2022
    Copy the full SHA
    88574c1 View commit details
  2. [DevTools] front-end for profiling event stack (#24805)

    * [DevTools] front-end for profiling event stack
    
    Adds a side-bar to the profiling tab. Users can now select an update event, and are
    shown the callstack from the originating component. When a source path is available
    there is now UI to jump to source.
    
    Add FB enabled feature flag: enableProfilerComponentTree for the side-bar.
    
    resolves #24170
    blakef authored Jun 28, 2022
    Copy the full SHA
    2e1c884 View commit details

Commits on Jun 29, 2022

  1. [Transition Tracing] Fix excess calls to the transition start callback (

    #24806)
    
    This PR fixes a bug where we would add a transition to the lanes map every time an update occurs. However, we didn't factor in that there might be multiple updates in a transition, which would cause the transition to be added multiple times to the transitionLanes map.
    
    This changes the transitionLanes object from an Array of Arrays to an Array of Sets so that we only add a transition if it hasn't been added before, avoiding duplicates
    lunaruan authored Jun 29, 2022
    Copy the full SHA
    d1432ba View commit details
  2. [DevTools] Log page URL in internal build (#24799)

    * test log
    
    * fix attribute name
    
    * fix lint
    
    * tabs can be empty
    
    * improve coding style per comments
    mondaychen authored Jun 29, 2022
    Copy the full SHA
    f01e119 View commit details
  3. [DevTools] Add column number to viewSourceLineFunction (#24814)

    Add column number for `viewSourceLineFunction` and renamed the function to `viewUrlSourceFunction` to match the other source function naming conventions
    lunaruan authored Jun 29, 2022
    Copy the full SHA
    cd80d32 View commit details
  4. [DevTools] Fix Bugs With Component Stacks (#24815)

    This PR:
    * Simplifies the code in `SidebarEventInfo` by passing it the actual clicked event rather than an index.
    * Lightly refactored the `SidebarEventInfo` code so that it can be used for more than just `schedulingEvents`
    * Fixes bug. Previously, whenever a state update event was clicked, we updated the `selectedCommitIndex` in the `ProfilerContext`. However, this index is used for the selected commit in the Flamegraph profiler, which caused a bug where if you would change the contents of the event sidebar, the commit sidebar in the Flamegraph profiler would change too. This PR replaces this with the actual event info instead
    lunaruan authored Jun 29, 2022
    Copy the full SHA
    1974d08 View commit details

Commits on Jun 30, 2022

  1. [DevTools] Resign Timeline Profiler Sidebar (#24816)

    This PR:
    * Redesigned the sidebar to resemble the flamegraph profiler sidebar and added title and timestamp to the sidebar
    * Added ability to copy the component stack (for places where you're unable to link to source)
    
    https://user-images.githubusercontent.com/2735514/176564897-5301d6d4-429a-4ea3-86cd-74427cff4ce6.mov
    lunaruan authored Jun 30, 2022
    Copy the full SHA
    4e1fcfa View commit details
  2. Land forked reconciler changes (#24817)

    This applies forked changes from the "new" reconciler to the "old" one.
    
    Includes:
    
    - d410f0a [FORKED] Bugfix: Offscreen instance is null during setState
    - 58bb117 [FORKED] Check for infinite update loops even if unmounted
    - 31882b5 [FORKED] Bugfix: Revealing a hidden update
    - 17691ac [FORKED] Don't update childLanes until after current render
    acdlite authored Jun 30, 2022
    Copy the full SHA
    6b6cf83 View commit details
  3. Add test gate alias for Offscreen (#24749)

    Offscreen is only enabled in the www and experimental channels. Instead
    of listing these on every Offscreen test, I added a test gate alias
    called `enableOffscreen`. Makes it easier to grep for these, and edit or
    remove the channels later.
    acdlite authored Jun 30, 2022
    Copy the full SHA
    a7b192e View commit details
  4. 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
    acdlite authored Jun 30, 2022
    Copy the full SHA
    1859329 View commit details
  5. [Transition Tracing] Refactor Transition Tracing Root Code (#24766)

    This PR refactors the transition tracing root code by reusing the tracing marker code. Namely it:
    * Refactors the tracing marker code so that it takes a tracing marker instance instead of a tracing marker fiber and rename the stack to `markerInstance` instead of `tracingMarker`
    * Pushes the root code onto the stack
    * Moves the instantiation of `root.incompleteTransitions` to the begin phase when we are pushing the root to the stack rather than in the commit phase
    lunaruan authored Jun 30, 2022
    Copy the full SHA
    4012963 View commit details
  6. Revert "[Transition Tracing] Refactor Transition Tracing Root Code (#…

    …24766)" (#24829)
    
    This reverts commit 4012963 because it's
    failing on main, likely due to conflict with something that landed before the
    PR was merged. Need to rebase and fix.
    acdlite authored Jun 30, 2022
    Copy the full SHA
    e61fd91 View commit details
  7. Revert "Revert [Transition Tracing] Refactor Transition Tracing Root …

    …Code" (#24830)
    
    * refactor root
    
    * old
    
    * Add comments and push actual marker instance in pushMarkerInstance
    
    * old
    
    * refactor pushRootMarkerInstance
    
    * old
    
    * fix test
    lunaruan authored Jun 30, 2022
    Copy the full SHA
    4cd788a View commit details

Commits on Jul 5, 2022

  1. Add missing null checks to OffscreenInstance code (#24846)

    `stateNode` is any-typed, so when reading from `stateNode` we should always cast
    it to the specific type for that type of work. I noticed a place in the commit
    phase where OffscreenInstance wasn't being cast. When I added the type
    assertion, it exposed some type errors where nullable values were being accessed
    without first being refined.
    
    I added the required null checks without verifying the logic of the existing
    code. If the existing logic was correct, then the extra null checks won't have
    any affect on the behavior, because all they do is refine from a nullable type
    to a non-nullable type in places where the type was assumed to already be
    non-nullable. But the result looks a bit fishy to me, so I also left behind some
    TODOs to follow up and verify it's correct.
    acdlite authored Jul 5, 2022
    Copy the full SHA
    c1f5884 View commit details
  2. Suspending inside a hidden tree should not cause fallbacks to appear (#…

    …24699)
    
    * [FORKED] Hidden trees should capture Suspense
    
    If something suspends inside a hidden tree, it should not affect
    anything in the visible part of the UI. This means that Offscreen acts
    like a Suspense boundary whenever it's in its hidden state.
    
    * Add previous commit to forked revisions
    acdlite authored Jul 5, 2022
    Copy the full SHA
    82e9e99 View commit details

Commits on Jul 6, 2022

  1. [Transition Tracing] Change Transition Type Passed Pending Transitions (

    #24856)
    
    This PR changes the type of the object we store in the pending transitions callbacks map. Previously, we were recreating the transition object that we initially created during `startTransition`. However, we can actually reuse the object instead (and it also gives us a stable way to identify a transition). This PR changes the implementation to reuse the transition object instead of creating a new one
    lunaruan authored Jul 6, 2022
    Copy the full SHA
    deab126 View commit details
  2. [Transition Tracing] Refactor Code to Remove OffscreeInstance TODOs (#…

    …24855)
    
    Refactored code to pass flow and remove TODOs introduced in #24846
    lunaruan authored Jul 6, 2022
    Copy the full SHA
    8e35b50 View commit details

Commits on Jul 7, 2022

  1. [DevTools][Bugfix] Fix DevTools Perf Issue When Unmounting Large Reac…

    …t Subtrees (#24863)
    
    We've recently had multiple reports where, if React DevTools was installed, unmounting large React subtrees would take a huge performance hit (ex. from 50ms to 7 seconds). 
    
    Digging in more, we realized for every fiber that unmounts, we called `untrackFibers`, which calls `clearTimeout` (and does some work manipulating a set, but this wasn't the bulk of the time). We ten call `recordUnmount`, which adds the timer back. Adding and removing the timer so many times was taking upwards of 50ms per timer add/remove call, which was resulting in exorbitant amounts of time spent in DevTools deleting subtrees.
    
    It looks like we are calling `untrackFibers` so many times to avoid a race condition with Suspense children where we unmount them twice (first a "virtual" unmount when the suspense boundary is toggled from visible to invisible, and then an actual unmount when the new children are rendered) without modifying `fiberIDMap`. We can fix this race condition by using the `untrackFibersSet` as a lock and not calling `recordUnmount` if the fiber is in the set and hasn't been processed yet. This works because the only way fibers are added in the set is via `recordUnmount` anyway.
    
    This PR also adds a test to make sure this change doesn't regress the previous behavior.
    
    **Before**
    ![image](https://user-images.githubusercontent.com/2735514/177655428-774ee306-0568-49ce-987e-b5213b613265.png)
    
    **After**
    ![image](https://user-images.githubusercontent.com/2735514/177655604-a217583f-787e-438e-b6f9-18953fe32444.png)
    lunaruan authored Jul 7, 2022
    Copy the full SHA
    c3b1857 View commit details
  2. Delete Partial Renderer SSR implementation (#24868)

    This removes the old server rendering implementation (the "Partial Renderer").
    It was replaced in React 18 with a new streaming implementation (Fizz).
    
    We hadn't removed it from the codebase yet because Facebook hadn't finished
    rolling out Fizz in production; it's been behind a feature flag while we run
    performance tests and migrate our internal infrastructure.
    
    The diff to land Fizz will land imminently, and once it does, we can merge
    this commit.
    acdlite authored Jul 7, 2022
    Copy the full SHA
    95e22ff View commit details

Commits on Jul 8, 2022

  1. Defer setState callbacks until component is visible (#24872)

    A class component `setState` callback should not fire if a component is inside a
    hidden Offscreen tree. Instead, it should wait until the next time the component
    is made visible.
    acdlite authored Jul 8, 2022
    Copy the full SHA
    5e4e2da View commit details
  2. Land forked reconciler changes (#24878)

    This applies forked changes from the "new" reconciler to the "old" one.
    
    Includes:
    
    - 67de5e3 [FORKED] Hidden trees should capture Suspense
    - 6ab05ee [FORKED] Track nearest Suspense handler on stack
    - 051ac55 [FORKED] Add HiddenContext to track if subtree is hidden
    acdlite authored Jul 8, 2022
    Copy the full SHA
    30eb267 View commit details
  3. [Transition Tracing] Add onTransitionProgress Callback (#24833)

    This PR adds support for `onTransitionProgress` (`onTransitionProgress(transitionName: string, startTime: number, currentTime: number, pending: Array<{name: null | string}>)`)
    
    We call this callback when:
        * When **a child suspense boundary of the transition commits in a fallback state**. Only the suspense boundaries that are triggered and commit in a fallback state when the transition first occurs (and all subsequent suspense boundaries in the initial suspense boundary's subtree) are considered a part of the transition
        * **A child suspense boundary of the transition resolves**
       
    When we call `onTransitionProgress`, we call the function with a `pending` array. This array contains the names of the transition's suspense boundaries that are still in a fallback state
    lunaruan authored Jul 8, 2022
    Copy the full SHA
    80208e7 View commit details
  4. [Transition Tracing] Tracing Marker Name Change in Update Warning (#2…

    …4873)
    
    We should only support Tracing Marker's name field during component mount. This PR adds a warning if the Tracing Marker's name changes during an update.
    lunaruan authored Jul 8, 2022
    Copy the full SHA
    dd2d652 View commit details

Commits on Jul 11, 2022

  1. [Transition Tracing] Don't call transition callbacks if no transition…

    … name specified (#24887)
    
    This PR checks to see if `transition.name` is defined before adding the transition so we avoid doing unnecessary work for transitions without a transition name
    lunaruan authored Jul 11, 2022
    Copy the full SHA
    e225fa4 View commit details

Commits on Jul 12, 2022

  1. Move ref commit effects inside switch statement

    Only certain fiber types can have refs attached to them, so this moves the
    Ref effect logic out of the common path and into the corresponding branch
    of the layout phase's switch statement.
    
    The types of fibers this affects are host components and class components.
    Function components are not affected because they can only have a ref via
    useImperativeHandle, which has a different implementation. The experimental
    Scope type attaches its refs in the mutation phase, not the layout phase.
    acdlite committed Jul 12, 2022
    Copy the full SHA
    b8c96b1 View commit details
Showing 2,394 changed files with 223,623 additions and 190,705 deletions.
Loading