The Wayback Machine - https://web.archive.org/web/20220327074019/https://github.com/facebook/react/commits/main
Skip to content
Permalink
main

Commits on Mar 25, 2022

  1. [fizz] Fix validateIterable call (#24166)

    * fix validate iterable call
    
    * supports iterable
    
    * gate test by experimental
    salazarm committed Mar 25, 2022
  2. Fix fixture

    gaearon committed Mar 25, 2022
  3. Attach DevTools Tree keyboard events to the Tree container (not the d…

    …ocument) (#24164)
    
    We used to listen to at the document level for this event. That allowed us to listen to up/down arrow key events while another section
    of DevTools (like the search input) was focused. This was a minor UX positive.
    
    (We had to use ownerDocument rather than document for this, because the DevTools extension renders the Components and Profiler tabs into portals.)
    
    This approach caused a problem though: it meant that a react-devtools-inline instance could steal (and prevent/block) keyboard events from other JavaScript on the page– which could even include other react-devtools-inline instances. This is a potential major UX negative.
    
    Given the above trade offs, we now listen on the root of the Tree itself.
    bvaughn committed Mar 25, 2022
  4. DevTools imports (#24163)

    * Update DevTools imports: react-dom -> react-dom/client
    * Silence ReactDOM.render warning in DevTools test shell
    bvaughn committed Mar 25, 2022
  5. Add Node 17 to devEngines

    gaearon committed Mar 25, 2022

Commits on Mar 24, 2022

  1. Clean up Selective Hydration / Event Replay flag (#24156)

    * clean up selective hydration / replay flag
    
    * dont export return_targetInst
    salazarm committed Mar 24, 2022
  2. Add details in READMEs for react-devtools local developement (#24148)

    * Add details in READMEs for react-devtools local developement
    
    * typo
    
    * update yarn for release script
    mondaychen committed Mar 24, 2022

Commits on Mar 23, 2022

  1. Store throws a specific Error type (UnsupportedBridgeOperationError) (#…

    …24147)
    
    When this Error type is detected, DevTools shows a custom error overlay with upgrade/downgrade instructions.
    bvaughn committed Mar 23, 2022
  2. Fix test-build-devtools if build was generated by build-for-devtools (#…

    …24088)
    
    Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
    eps1lon and bvaughn committed Mar 23, 2022

Commits on Mar 22, 2022

Commits on Mar 21, 2022

  1. enableCacheElement flag (#24131)

    * enableCacheElement flag
    
    * Update packages/shared/forks/ReactFeatureFlags.testing.js
    
    Co-authored-by: Ricky <rickhanlonii@gmail.com>
    
    * Update packages/shared/forks/ReactFeatureFlags.test-renderer.js
    
    Co-authored-by: Ricky <rickhanlonii@gmail.com>
    
    * Update packages/shared/forks/ReactFeatureFlags.native-oss.js
    
    Co-authored-by: Ricky <rickhanlonii@gmail.com>
    
    * Update packages/shared/ReactFeatureFlags.js
    
    Co-authored-by: Ricky <rickhanlonii@gmail.com>
    
    Co-authored-by: Dave McCabe <davemccabe@fb.com>
    Co-authored-by: Ricky <rickhanlonii@gmail.com>
    3 people committed Mar 21, 2022

Commits on Mar 20, 2022

  1. Allow updating dehydrated root at lower priority without forcing clie…

    …nt render (#24082)
    
    * Pass children to hydration root constructor
    
    I already made this change for the concurrent root API in #23309. This
    does the same thing for the legacy API.
    
    Doesn't change any behavior, but I will use this in the next steps.
    
    * Add isRootDehydrated function
    
    Currently this does nothing except read a boolean field, but I'm about
    to change this logic.
    
    Since this is accessed by React DOM, too, I put the function in a
    separate module that can be deep imported. Previously, it was accessing
    the FiberRoot directly. The reason it's a separate module is to break a
    circular dependency between React DOM and the reconciler.
    
    * Allow updates at lower pri without forcing client render
    
    Currently, if a root is updated before the shell has finished hydrating
    (for example, due to a top-level navigation), we immediately revert to
    client rendering. This is rare because the root is expected is finish
    quickly, but not exceedingly rare because the root may be suspended.
    
    This adds support for updating the root without forcing a client render
    as long as the update has lower priority than the initial hydration,
    i.e. if the update is wrapped in startTransition.
    
    To implement this, I had to do some refactoring. The main idea here is
    to make it closer to how we implement hydration in Suspense boundaries:
    
    - I moved isDehydrated from the shared FiberRoot object to the
    HostRoot's state object.
    - In the begin phase, I check if the root has received an by comparing
    the new children to the initial children. If they are different, we
    revert to client rendering, and set isDehydrated to false using a
    derived state update (a la getDerivedStateFromProps).
    - There are a few places where we used to set root.isDehydrated to false
    as a way to force a client render. Instead, I set the ForceClientRender
    flag on the root work-in-progress fiber.
    - Whenever we fall back to client rendering, I log a recoverable error.
    
    The overall code structure is almost identical to the corresponding
    logic for Suspense components.
    
    The reason this works is because if the update has lower priority than
    the initial hydration, it won't be processed during the hydration
    render, so the children will be the same.
    
    We can go even further and allow updates at _higher_ priority (though
    not sync) by implementing selective hydration at the root, like we do
    for Suspense boundaries: interrupt the current render, attempt hydration
    at slightly higher priority than the update, then continue rendering the
    update. I haven't implemented this yet, but I've structured the code in
    anticipation of adding this later.
    
    * Wrap useMutableSource logic in feature flag
    acdlite committed Mar 20, 2022

Commits on Mar 18, 2022

  1. Avoid conditions where control flow is sufficient (#24126)

    This also fixes a type error since resetTextContent can only be called
    on Instances.
    sebmarkbage committed Mar 18, 2022

Commits on Mar 17, 2022

  1. fix inspecting an element in a nested renderer bug (#24116)

    Fixes this issue, where inspecting components in nested renderers results in an error. The reason for this is because we have different fiberToIDMap instances for each renderer, and owners of a component could be in different renderers.
    
    This fix moves the fiberToIDMap and idToArbitraryFiberMap out of the attach method so there's only one instance of each for all renderers.
    lunaruan committed Mar 17, 2022
  2. Fix createRoot container signature (#24110)

    The internal Container type represents the types of containers that React
    can support in its internals that deal with containers.
    
    This didn't include DocumentFragment which we support specifically for
    rendering into shadow roots.
    
    However, not all types makes sense to pass into the createRoot API.
    
    One of those is comment nodes that is deprecated and we don't really fully
    support. It really only exists for FB legacy.
    
    For createRoot it doesn't make sense to pass a Document since that will try
    to empty the document which removes the HTML tag which doesn't work.
    Documents can only be passed to hydrateRoot.
    
    Conversely I'm not sure we actually support hydrating a shadow root properly
    so I excluded DocumentFragment from hydrateRoot.
    sebmarkbage committed Mar 17, 2022

Commits on Mar 16, 2022

  1. Flag for text hydration mismatch (#24107)

    * flag for text hydration mismatch
    
    * rm unused import
    salazarm committed Mar 16, 2022
  2. Add authorization header to artifacts request (#24106)

    * Add authorization header to artifacts request
    
    CircleCI's artifacts API was updated; it now errors unless you're
    logged in. This affects any of our workflows that download
    build artifacts.
    
    To fix, I added an authorization header to the request.
    
    * Update sizbot to pull artifacts from public mirror
    
    We can't use the normal download-build script in sizebot because it
    depends on the CircleCI artifacts API, which was recently changed to
    require authorization. And we can't pass an authorization token
    without possibly leaking it to the public, since we run sizebot on
    PRs from external contributors. As a temporary workaround, this job
    will pull the artifacts from a public mirror that I set up. But we
    should find some other solution so we don't have to maintain
    the mirror.
    acdlite committed Mar 16, 2022

Commits on Mar 15, 2022

  1. add offscreen state node (#24026)

    Add state node on Offscreen fibers with id (in preparation for transition tracing)
    lunaruan committed Mar 15, 2022
  2. Update CHANGELOG.md

    bvaughn committed Mar 15, 2022
  3. Disable unsupported Bridge protocol version dialog and add workaround…

    … for old protocol operations format (#24093)
    
    Rationale: The only case where the unsupported dialog really matters is React Naive. That's the case where the frontend and backend versions are most likely to mismatch. In React Native, the backend is likely to send the bridge protocol version before sending operations– since the agent does this proactively during initialization.
    
    I've tested the React Native starter app– after forcefully downgrading the backend version to 4.19.1 (see #23307 (comment)) and verified that this change "fixes" things. Not only does DevTools no longer throw an error that causes the UI to be hidden– it works (meaning that the Components tree can be inspected and interacted with).
    bvaughn committed Mar 15, 2022

Commits on Mar 13, 2022

  1. Fix use of hydrateRoot in DevTools test (#24084)

    I noticed while working on a different PR that this test was not
    using hydrateRoot correctly. You're meant to pass the initial children
    as the second argument.
    acdlite committed Mar 13, 2022

Commits on Mar 12, 2022

  1. Allow updates at lower pri without forcing client render

    Currently, if a root is updated before the shell has finished hydrating
    (for example, due to a top-level navigation), we immediately revert to
    client rendering. This is rare because the root is expected is finish
    quickly, but not exceedingly rare because the root may be suspended.
    
    This adds support for updating the root without forcing a client render
    as long as the update has lower priority than the initial hydration,
    i.e. if the update is wrapped in startTransition.
    
    To implement this, I had to do some refactoring. The main idea here is
    to make it closer to how we implement hydration in Suspense boundaries:
    
    - I moved isDehydrated from the shared FiberRoot object to the
    HostRoot's state object.
    - In the begin phase, I check if the root has received an by comparing
    the new children to the initial children. If they are different, we
    revert to client rendering, and set isDehydrated to false using a
    derived state update (a la getDerivedStateFromProps).
    - There are a few places where we used to set root.isDehydrated to false
    as a way to force a client render. Instead, I set the ForceClientRender
    flag on the root work-in-progress fiber.
    - Whenever we fall back to client rendering, I log a recoverable error.
    
    The overall code structure is almost identical to the corresponding
    logic for Suspense components.
    
    The reason this works is because if the update has lower priority than
    the initial hydration, it won't be processed during the hydration
    render, so the children will be the same.
    
    We can go even further and allow updates at _higher_ priority (though
    not sync) by implementing selective hydration at the root, like we do
    for Suspense boundaries: interrupt the current render, attempt hydration
    at slightly higher priority than the update, then continue rendering the
    update. I haven't implemented this yet, but I've structured the code in
    anticipation of adding this later.
    acdlite committed Mar 12, 2022
  2. Add isRootDehydrated function

    Currently this does nothing except read a boolean field, but I'm about
    to change this logic.
    
    Since this is accessed by React DOM, too, I put the function in a
    separate module that can be deep imported. Previously, it was accessing
    the FiberRoot directly. The reason it's a separate module is to break a
    circular dependency between React DOM and the reconciler.
    acdlite committed Mar 12, 2022
  3. Pass children to hydration root constructor

    I already made this change for the concurrent root API in #23309. This
    does the same thing for the legacy API.
    
    Doesn't change any behavior, but I will use this in the next steps.
    acdlite committed Mar 12, 2022

Commits on Mar 10, 2022

  1. [Flight] add support for Lazy components in Flight server (#24068)

    * [Flight] add support for Lazy components in Flight server
    
    Lazy components suspend until resolved just like in Fizz. Add tests to confirm Lazy works with Shared Components and Client Component references.
    
    * Support Lazy elements
    
    React.Lazy can now return an element instead of a Component. This commit implements support for Lazy elements when server rendering.
    
    * add lazy initialization to resolveModelToJson
    
    adding lazying initialization toResolveModelToJson means we use attemptResolveElement's full logic on whatever the resolved type ends up being. This better aligns handling of misued Lazy types like a lazy element being used as a Component or a lazy Component being used as an element.
    gnoff committed Mar 10, 2022
  2. React DevTools 4.23.0 -> 4.24.0 (#24066)

    * Revert "React DevTools 4.23.0 -> 4.24.0 (#23400)"
    
    This reverts commit f6c130f.
    
    * React DevTools 4.23.0 -> 4.24.0
    
    * Added additional, pending bugfixes to CHANGELOG
    
    * Updated DevTools build and release script to fix header format
    bvaughn committed Mar 10, 2022
Older