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: react/react
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d5736f09
Choose a base ref
...
head repository: react/react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 75b0945b
Choose a head ref
  • 6 commits
  • 49 files changed
  • 5 contributors

Commits on May 13, 2026

  1. fix[describeClassComponentFrame]: invoke constructor with new keyword (

    …#36455)
    
    For JavaScript runtimes that do not have
    [`Reflect`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect)
    supported, we had a fall back that was calling the constructor with
    overridden `this` context via
    ```
    fn.apply(Fake.prototype);
    ```
    
    In ES6, it is required to call constructor only with the `new` keyword,
    otherwise the runtime is expected to throw a corresponding TypeError:
    ```
    TypeError: Class constructor <> cannot be invoked without 'new'
    ```
    
    We've observed this error in Hermes runtime, but this is applicable to
    V8 or any other runtime. The only reason why V8 wasn't affected is
    because it implemented Reflect APIs.
    
    Instead of the incorrect call, we will fall back to calling `new fn()`,
    but with a temporary patched prototype of the class, which would make a
    trap out of the setter for `props` object. We use the same approach when
    `Reflect` APIs are available, but instead of modifying the prototype, we
    pass the fake context:
    
    https://github.com/facebook/react/blob/d5736f098edee62c44f27b053e6e48f5fa443803/packages/shared/ReactComponentStackFrame.js#L129-L148
    
    
    ---
    
    See tests implemented. Without the changes, the test would fail with the
    `TypeError` mentioned above.
    hoxyq authored May 13, 2026
    Configuration menu
    Copy the full SHA
    8fc5763 View commit details
    Browse the repository at this point in the history

Commits on May 14, 2026

  1. Add ViewTransition event callback unit tests (#36467)

    Pulling some basic test coverage out of
    #36135 as these unit tests are
    needed regardless of nested enter/exit work.
    jackpope authored May 14, 2026
    Configuration menu
    Copy the full SHA
    f6790c1 View commit details
    Browse the repository at this point in the history
  2. [FlightReply] Don't drop FormData entries in decodeReplyFromBusboy (#…

    …36468)
    
    Fixes a regression from #36425 where referenced `FormData` entries can
    be dropped by `decodeReplyFromBusboy` when files are interleaved with
    text fields in the payload.
    
    `decodeReplyFromBusboy` queues text fields that arrive while a file is
    being streamed and flushes them after the last file's `'end'`, working
    around busboy emitting `'end'` deferred relative to subsequent `'field'`
    events. With multiple files interleaved with text, this loses the
    relative order of the affected text entries. The reorder was a
    long-standing but invisible issue — entries came back in the wrong order
    but were all present — until #36425 tightened how referenced FormData
    entries are collected from the backing store to rely on them being
    contiguous. With that assumption violated, referenced FormDatas can now
    come back with some entries dropped. The pattern is most easily surfaced
    through `useActionState` actions that return the submitted `FormData` as
    part of their state.
    
    This replaces the tail-flush with a linked list of pending files. Text
    fields that arrive while a file is in flight are queued on the tail
    file's `queuedFields`; fields that arrive when the list is empty resolve
    immediately. `flush()` walks from the head, resolving each completed
    file followed by its queued fields, and stops at the first file that
    hasn't ended yet. The backing FormData now matches the payload's order,
    restoring the contiguity assumption (and fixing the long-standing
    reorder as a side effect). The same change is applied to all five copies
    in `react-server-dom-{webpack,turbopack,parcel,esm,unbundled}`. Two new
    tests cover the multi-file interleave.
    
    fixes vercel/next.js#93822
    unstubbable authored May 14, 2026
    Configuration menu
    Copy the full SHA
    b91823e View commit details
    Browse the repository at this point in the history

Commits on May 21, 2026

  1. [compiler] Don't emit spurious import { c as _c } for discarded fun…

    …ctions (#36500)
    
    ## What
    
    Codegen registers `_c` (the memo cache import) as a side effect whenever
    a function compiles with memo slots. The registration persists on
    `ProgramContext.imports` even if the function is later discarded (`'use
    no forget'`, `'use no memo'`, lint mode, validation errors). If other
    applied functions in the file compile to 0 memo slots, the stale `import
    { c as _c } from "react/compiler-runtime";` leaks into the output.
    
    ## Fix
    
    In `applyCompiledFunctions`, drop the memo cache import if no applied
    function uses memo slots. If `react/compiler-runtime` has no remaining
    specifiers, drop the module entry too so we don't emit a bare `import
    "react/compiler-runtime";`.
    
    ## Reproducer
    
    `use-no-forget-multiple-with-eslint-suppression.js`:
    
    ```js
    import {useRef} from 'react';
    
    const useControllableState = options => {};
    function NoopComponent() {}
    
    function Component() {
      'use no forget';
      const ref = useRef(null);
      // eslint-disable-next-line react-hooks/rules-of-hooks
      ref.current = 'bad';
      return <button ref={ref} />;
    }
    ```
    
    `NoopComponent` applies with 0 memo slots. `Component` is opted out, but
    codegen already registered `_c` for it. Before:
    
    ```js
    import { c as _c } from "react/compiler-runtime";
    import { useRef } from "react";
    ```
    
    After:
    
    ```js
    import { useRef } from "react";
    ```
    
    ## Prior art
    
    TS counterpart to the Rust port's fix in
    7e26eb8. That commit also added
    `no-cache-slots-no-import.js`, which codifies the "no memo slots, no
    import" rule.
    
    ## Test plan
    
    - `yarn snap`: 1719/1719 passing
    - Snapshot for `use-no-forget-multiple-with-eslint-suppression` loses
    its spurious `_c` import
    - `no-cache-slots-no-import` still passes
    poteto authored May 21, 2026
    Configuration menu
    Copy the full SHA
    008a6d4 View commit details
    Browse the repository at this point in the history

Commits on May 26, 2026

  1. Configuration menu
    Copy the full SHA
    926fa85 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    75b0945 View commit details
    Browse the repository at this point in the history
Loading