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: 06d0b89e
Choose a base ref
...
head repository: facebook/react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 187dd6a7
Choose a head ref
  • 18 commits
  • 78 files changed
  • 7 contributors

Commits on Aug 1, 2024

  1. Cloned flag to avoid extra clones in persistent renderer (#27647)

    Persistent renderers used the `Update` effect flag to check if a subtree
    needs to be cloned. In some cases, that causes extra renders, such as
    when a layout effect is triggered which only has an effect on the JS
    side, but doesn't update the host components.
    
    It's been a bit tricky to find the right places where this needs to be
    set and I'm not 100% sure I got all the cases even though the tests
    passed.
    kassens authored Aug 1, 2024
    Configuration menu
    Copy the full SHA
    5fb67fa View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2024

  1. chore[react-devtools]: add global for native and use it to fork backe…

    …nd implementation (#30533)
    
    Adding `__IS_NATIVE__` global, which will be used for forking backend
    implementation. Will only be set to `true` for `react-devtools-core`
    package, which is used by `react-native`.
    
    Ideally, we should name it `react-devtools-native`, and keep
    `react-devtools-core` as host-agnostic.
    
    With this change, the next release of `react-devtools-core` should
    append component stack as Error object, not as string, and should add
    `(<anonymous>)` suffix to component stack frames.
    hoxyq authored Aug 2, 2024
    Configuration menu
    Copy the full SHA
    8269d55 View commit details
    Browse the repository at this point in the history
  2. [compiler] Validate against setState in useMemo (resubmit of #30552)

    ghstack failed to land #30552 properly, resubmitting
    
    Developers sometimes use `useMemo()` as a way to conditionally execute code, including conditionally calling setState. However, the compiler may remove existing useMemo calls if they are not necessary, which _should_ always be a safe optimization. If the useMemo has side effects (eg sets state), then this isn't safe.
    
    This PR improves ValidateNoSetStateInRender to disallow any setState in useMemo (even if it's conditional), expanding on the previous check for unconditional setState in render. Note that the approach uses the StartMemoize/FinishMemoize instructions added in DropManualMemo to know whether a particular setState call is within a useMemo or not. This means enabling the validation in DropManualMemo when the setState validation is enabled, but that's fine since that validation is on everywhere by default (_except_ for in fixtures, which we have a todo for)
    
    ghstack-source-id: 65bb328
    Pull Request resolved: #30583
    josephsavona committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    1db4d6c View commit details
    Browse the repository at this point in the history
  3. [compiler] Simplify FunctionExpression node

    Rather than storing the entire babel node, store only the required
    information which is the node type.
    
    This will be useful for when we synthesize new functions that don't have
    a corresponding babel node.
    
    ghstack-source-id: 9098cbd
    Pull Request resolved: #30544
    gsathya committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    a5a5816 View commit details
    Browse the repository at this point in the history
  4. [compiler] Refactor makeTemporary outside HIRBuilder

    This is a useful utility function similar to the existing
    `makeInstructionId` and `makeIdentifierId` functions.
    
    This PR moves it outside the HIRBuilder so we can use this in passes
    that don't have access to the builder instance.
    
    ghstack-source-id: 1ac0839
    Pull Request resolved: #30545
    gsathya committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    ce60785 View commit details
    Browse the repository at this point in the history
  5. [compiler] Add typing for useContext hook

    In the future, we can use this to identify useContext calls.
    
    ghstack-source-id: 01d7b09
    Pull Request resolved: #30546
    gsathya committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    f5f9899 View commit details
    Browse the repository at this point in the history
  6. [compiler] Add flag for lowering context access

    *This is only for internal profiling, not intended to ship.*
    
    ghstack-source-id: e48998b
    Pull Request resolved: #30547
    gsathya committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    bae18b4 View commit details
    Browse the repository at this point in the history
  7. [compiler] Allow global mutation effects in arguments passed to hooks…

    … and in return values
    
    ghstack-source-id: f9ea675
    Pull Request resolved: #30576
    mvitousek committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    47337a8 View commit details
    Browse the repository at this point in the history
  8. [DevTools] Allow Highlighting/Inspect HostSingletons/Hoistables and R…

    …esources (#30584)
    
    Basically the new Float types needs to be supported. Resources are a bit
    special because they're a DOM specific type but we can expect any other
    implementation using resources to provide and instance on this field if
    needed.
    
    There's a slightly related case for the reverse lookup. You can already
    select a singleton or hoistable (that's not a resource) in the browser
    elements panel and it'll select the corresponding node in the RDT
    Components panel. That works because it uses the same mechanism as event
    dispatching and those need to be able to receive events.
    
    However, you can't select a resource. Because that's conceptually one to
    many. We could in principle just search the tree for the first one or
    keep a map of currently mounted resources and just pick the first fiber
    that created it. So that you can select a resource and see what created
    it. Particularly useful when there's only one Fiber which is most of the
    time.
    
    ---------
    
    Co-authored-by: Ruslan Lesiutin <rdlesyutin@gmail.com>
    sebmarkbage and hoxyq authored Aug 2, 2024
    Configuration menu
    Copy the full SHA
    ed94ea1 View commit details
    Browse the repository at this point in the history
  9. [DevTools] Rename mountFiberRecursively/updateFiberRecursively (#30586)

    This is just for clarity at first.
    
    Before: 
    - mountFiberRecursively accepts a set of children and flag that says
    whether to just do one
    - updateFiberRecursively accepts a fiber and loops over its children
    - unmountFiberChildrenRecursively accepts a fiber and loops over its
    children
    
    After:
    - mountFiberRecursively accepts a Fiber and calls
    mountChildrenRecursively
    - updateFiberRecursively accepts a Fiber and calls
    updateChildrenRecursively
    - unmountFiberRecursively accepts a Fiber and calls
    unmountChildrenRecursively
    - mountChildrenRecursively accepts a set of children and loops over each
    one
    - updateChildrenRecursively accepts a set of children and loops over
    each one
    - unmountChildrenRecursively accepts a set of children and loops over
    each one
    
    So now there's one place where things happens for the single item and
    one place where we do the loop.
    sebmarkbage authored Aug 2, 2024
    Configuration menu
    Copy the full SHA
    aa8469f View commit details
    Browse the repository at this point in the history
  10. [compiler] Fix issue with macro arguments being outlined

    Summary:
    Fixes issue documented by #30435. We change the pipeline order so that outlining comes after tracking macro operands, and any function that is referenced in a macro will now not be outlined.
    
    ghstack-source-id: f731ad6
    Pull Request resolved: #30587
    mvitousek committed Aug 2, 2024
    Configuration menu
    Copy the full SHA
    3af905d View commit details
    Browse the repository at this point in the history
  11. [DevTools] Track DOM nodes to Fiber map for HostHoistable Resources (#…

    …30590)
    
    Follow up from #30584.
    
    You can already select a singleton or hoistable (that's not a resource)
    in the browser elements panel and it'll select the corresponding node in
    the RDT Components panel. That works because it uses the same mechanism
    as event dispatching and those need to be able to receive events.
    However, you can't select a resource. Because that's conceptually one to
    many.
    
    This keeps track of which fiber is acquiring which resource so we can
    find all the corresponding instances.
    
    E.g. now you can select the `<link rel="stylesheet">` in the Flight
    fixture in the Element panel and then the component that rendered it in
    the Components panel will be selected.
    
    If we had a concept multi-selection we could potentially select all of
    them. This similar to how a Server Component can be rendered in more
    than one place and if we want to select all matching ones. It's kind of
    weird though and both cases are edge cases.
    
    Notably imperative preloads do have elements that don't have any
    corresponding component but that's ok. So they'll just select `<head>`.
    Maybe in dev we could track the owners of those.
    sebmarkbage authored Aug 2, 2024
    Configuration menu
    Copy the full SHA
    8a70d31 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2024

  1. [Flight] Warn for keyless fragments in an array (#30588)

    Conceptually this is the same as rendering this as if it was a built-in
    Server Component.
    sebmarkbage authored Aug 3, 2024
    Configuration menu
    Copy the full SHA
    ba6a9e9 View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2024

  1. chore[packages/react-devtools]: remove unused index.js (#30579)

    This is unused. See
    #30533 (comment).
    
    Ran a fresh build of `react-devtools` via `yarn start` in
    `packages/react-devtools` to validate that it is still works with React
    Native.
    hoxyq authored Aug 5, 2024
    Configuration menu
    Copy the full SHA
    6750423 View commit details
    Browse the repository at this point in the history
  2. Fix typos in Turbopack configuration and in Node.js loader error mess…

    …ages (#30593)
    
    <!--
      Thanks for submitting a pull request!
    We appreciate you spending the time to work on these changes. Please
    provide enough information so that others can review your pull request.
    The three fields below are mandatory.
    
    Before submitting a pull request, please make sure the following is
    done:
    
    1. Fork [the repository](https://github.com/facebook/react) and create
    your branch from `main`.
      2. Run `yarn` in the repository root.
    3. If you've fixed a bug or added code that should be tested, add tests!
    4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
    TestName` is helpful in development.
    5. Run `yarn test --prod` to test in the production environment. It
    supports the same options as `yarn test`.
    6. If you need a debugger, run `yarn test --debug --watch TestName`,
    open `chrome://inspect`, and press "Inspect".
    7. Format your code with
    [prettier](https://github.com/prettier/prettier) (`yarn prettier`).
    8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
    check changed files.
      9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
      10. If you haven't already, complete the CLA.
    
    Learn more about contributing:
    https://reactjs.org/docs/how-to-contribute.html
    -->
    
    ## Summary
    
    Just fixing some copy-paste typos.
    
    ## How did you test this change?
    
    Untested.
    GregBrimble authored Aug 5, 2024
    Configuration menu
    Copy the full SHA
    c0ee8e9 View commit details
    Browse the repository at this point in the history
  3. Remove flag enableUseDeferredValueInitialArg (#30595)

    This is enabled everywhere for a while and I don't think we'd be backing
    this out of 19. Seems like it's good to clean up to me.
    kassens authored Aug 5, 2024
    Configuration menu
    Copy the full SHA
    6590358 View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2024

  1. [compiler] Refactor createTemporaryPlace

    Update createTemporaryPlace to use makeTemporary and also rename
    makeTemporary to makeTemporaryIdentifier to make it less ambiguous.
    
    ghstack-source-id: b5955d3
    Pull Request resolved: #30585
    gsathya committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    eb1d52b View commit details
    Browse the repository at this point in the history
  2. Replace NodeJS 21 with 22 in devEngines field (#30598)

    21 is EOL and 22 is stable now.
    
    Homebrew installs 22 by default as well which is the practical reason
    for me to update this.
    kassens authored Aug 6, 2024
    Configuration menu
    Copy the full SHA
    187dd6a View commit details
    Browse the repository at this point in the history
Loading