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: 3edc000d7717027a1ce23611070a56358040a554
Choose a base ref
...
head repository: facebook/react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d8c90fa48d3addefe4b805ec56a3c65e4ee39127
Choose a head ref
  • 15 commits
  • 81 files changed
  • 5 contributors

Commits on Sep 27, 2024

  1. [playground] Decouple playground from compiler

    Currently the playground is setup as a linked workspace for the
    compiler which complicates our yarn workspace setup and means that snap
    can sometimes pull in a different version of react than was otherwise
    specified.
    
    There's no real reason to have these workspaces combined so let's split
    them up.
    
    ghstack-source-id: 56ab064b2fc45366f5d96d37c5d4c5dc26590234
    Pull Request resolved: #31081
    poteto committed Sep 27, 2024
    2 Configuration menu
    Copy the full SHA
    db24098 View commit details
    Browse the repository at this point in the history

Commits on Sep 30, 2024

  1. fix[scripts/devtools/publish-release]: parse version list instead of …

    …handling 404 (#31087)
    
    Discovered yesterday while was publishing a new release.
    
    NPM `10.x.x` changed the text for 404 errors, so this check was failing.
    Instead of handling 404 as a signal, I think its better to just parse
    the whole list of versions and check if the new one is already there.
    hoxyq authored Sep 30, 2024
    Configuration menu
    Copy the full SHA
    2d16326 View commit details
    Browse the repository at this point in the history
  2. [compiler][test fixtures] Fork more fixtures for hir-rewrite

    Followup from #30894 , not sure how these got missed. Note that this PR just copies the fixtures without adding `@enablePropagateDepsInHIR`. #31032 follows and actually enables the HIR-version of propagateScopeDeps to run. I split this out into two PRs to make snapshot differences easier to review, but also happy to merge
    
    Fixtures found from locally setting snap test runner to default to `enablePropagateDepsInHIR: 'enabled_baseline'` and forking fixtures files with different output.
    
    ghstack-source-id: 7d7cf41aa923d83ad49f89079171b0411923ce6b
    Pull Request resolved: #31030
    mofeiZ committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    943e45e View commit details
    Browse the repository at this point in the history
  3. [compiler][test fixtures] Add enablePropagateDepsInHIR to forked tests

    Annotates fixtures added in #31030 with `@enablePropagateDepsInHIR` to fork behavior (and commit snapshot differences)
    ghstack-source-id: e423e8c42db62f1bb87562b770761be09fc8ffc6
    Pull Request resolved: #31031
    mofeiZ committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    1a77920 View commit details
    Browse the repository at this point in the history
  4. [compiler][hir-rewrite] Infer non-null props, destructure source

    Followup from #30894.
    This adds a new flagged mode `enablePropagateScopeDepsInHIR: "enabled_with_optimizations"`, under which we infer more hoistable loads:
    - it's always safe to evaluate loads from `props` (i.e. first parameter of a `component`)
    - destructuring sources are safe to evaluate loads from (e.g. given `{x} = obj`, we infer that it's safe to evaluate obj.y)
    - computed load sources are safe to evaluate loads from (e.g. given `arr[0]`, we can infer that it's safe to evaluate arr.length)
    
    ghstack-source-id: 32f3bb72e9f85922825579bd785d636f4ccf724d
    Pull Request resolved: #31033
    mofeiZ committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    8c89fa7 View commit details
    Browse the repository at this point in the history
  5. [compiler][hir-rewrite] Cleanup Identifier -> IdentifierId

    Since removing ExitSSA, Identifier and IdentifierId should mean the same thing
    
    ghstack-source-id: 076cacbe8360e716b0555088043502823f9ee72e
    Pull Request resolved: #31034
    mofeiZ committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    58a3ca3 View commit details
    Browse the repository at this point in the history
  6. [compiler] repro for dep merging edge case (non-hir)

    Found when writing #31037, summary copied from comments:
    
    This is an extreme edge case and not code we'd expect any reasonable developer to write. In most cases e.g. `(a?.b != null ? a.b : DEFAULT)`, we do want to take a dependency on `a?.b`.
    
    I found this trying to come up with edge cases that break the current dependency + CFG merging logic. I think it makes sense to error on the side of correctness. After all, we still take `a` as a dependency if users write `a != null ? a.b : DEFAULT`, and the same fix (understanding the `<hoistable> != null` test expression) works for both. Can be convinced otherwise though!
    
    ghstack-source-id: cc06afda59f7681e228495f5e35a596c20f875f5
    Pull Request resolved: #31035
    mofeiZ committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    5d12e9e View commit details
    Browse the repository at this point in the history
  7. [compiler][fixtures] Patch error-handling edge case in snap evaluator

    Fix edge case in which we incorrectly returned a cached exception instead of trying to rerender with new props.
    ghstack-source-id: 843fb85df4a2ae7a88f296104fb16b5f9a34c76e
    Pull Request resolved: #31082
    mofeiZ committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    2cbea24 View commit details
    Browse the repository at this point in the history
  8. [compiler] Renames and no-op refactor for next PR

    Rename for clarity:
    - `CollectHoistablePropertyLoads:Tree` -> `CollectHoistablePropertyLoads:PropertyPathRegistry`
        - `getPropertyLoadNode` -> `getOrCreateProperty`
        - `getOrCreateRoot` -> `getOrCreateIdentifier`
    - `PropertyLoadNode` -> `PropertyPathNode`
    
    Refactor to CFG joining logic for `CollectHoistablePropertyLoads`. We now write to the same set of inferredNonNullObjects when traversing from entry and exit blocks. This is more correct, as non-nulls inferred from a forward traversal should be included when computing the backward traversal (and vice versa). This fix is needed by an edge case in #31036
    
    Added invariant into fixed-point iteration to terminate (instead of infinite looping).
    
    ghstack-source-id: 1e8eb2d566b649ede93de9a9c13dad09b96416a5
    Pull Request resolved: #31036
    mofeiZ committed Sep 30, 2024
    Configuration menu
    Copy the full SHA
    c67e241 View commit details
    Browse the repository at this point in the history
  9. [Flight] Serialize Error Values (#31104)

    The idea is that the RSC protocol is a superset of Structured Clone.
    #25687 One exception that we left out was serializing Error objects as
    values. We serialize "throws" or "rejections" as Error (regardless of
    their type) but not Error values.
    
    This fixes that by serializing `Error` objects. We don't include digest
    in this case since we don't call `onError` and it's not really expected
    that you'd log it on the server with some way to look it up.
    
    In general this is not super useful outside throws. Especially since we
    hide their values in prod. However, there is one case where it is quite
    useful. When you replay console logs in DEV you might often log an Error
    object within the scope of a Server Component. E.g. the default RSC
    error handling just console.error and error object.
    
    Before this would just be an empty object due to our lax console log
    serialization:
    <img width="1355" alt="Screenshot 2024-09-30 at 2 24 03 PM"
    src="https://github.com/user-attachments/assets/694b3fd3-f95f-4863-9321-bcea3f5c5db4">
    After:
    <img width="1348" alt="Screenshot 2024-09-30 at 2 36 48 PM"
    src="https://github.com/user-attachments/assets/834b129d-220d-43a2-a2f4-2eb06921747d">
    
    TODO for a follow up: Flight Reply direction. This direction doesn't
    actually serialize thrown errors because they always reject the
    serialization.
    sebmarkbage authored Sep 30, 2024
    Configuration menu
    Copy the full SHA
    326832a View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2024

  1. [Flight] Serialize Server Components Props in DEV (#31105)

    This allows us to show props in React DevTools when inspecting a Server
    Component.
    
    I currently drastically limit the object depth that's serialized since
    this is very implicit and you can have heavy objects on the server.
    
    We previously was using the general outlineModel to outline
    ReactComponentInfo but we weren't consistently using it everywhere which
    could cause some bugs with the parsing when it got deduped on the
    client. It also lead to the weird feature detect of `isReactComponent`.
    It also meant that this serialization was using the plain serialization
    instead of `renderConsoleValue` which means we couldn't safely serialize
    arbitrary debug info that isn't serializable there.
    
    So the main change here is to call `outlineComponentInfo` and have that
    always write every "Server Component" instance as outlined and in a way
    that lets its props be serialized using `renderConsoleValue`.
    
    <img width="1150" alt="Screenshot 2024-10-01 at 1 25 05 AM"
    src="https://github.com/user-attachments/assets/f6e7811d-51a3-46b9-bbe0-1b8276849ed4">
    sebmarkbage authored Oct 1, 2024
    Configuration menu
    Copy the full SHA
    654e387 View commit details
    Browse the repository at this point in the history
  2. fix[react-devtools]: request hook initialization inside http server r…

    …esponse (#31102)
    
    Fixes #31100.
    
    There are 2 things:
    1. In #30987, we've introduced a
    breaking change: importing `react-devtools-core` is no longer enough for
    installing React DevTools global Hook. You need to call `initialize`, in
    which you may provide initial settings. I am not adding settings here,
    because it is not implemented, and there are no plans for supporting
    this.
    2. Calling `installHook` is not necessary inside `standalone.js`,
    because this script is running inside Electron wrapper (which is just a
    UI, not the app that we are debugging). We will loose the ability to use
    React DevTools on this React application, but I guess thats fine.
    hoxyq authored Oct 1, 2024
    Configuration menu
    Copy the full SHA
    40357fe View commit details
    Browse the repository at this point in the history
  3. chore[react-devtools]: add legacy mode error message to the ignore li…

    …st for tests (#31060)
    
    Without this, the console gets spammy whenever we run React DevTools
    tests against React 18.x, where this deprecation message was added.
    hoxyq authored Oct 1, 2024
    Configuration menu
    Copy the full SHA
    9ea5ffa View commit details
    Browse the repository at this point in the history
  4. chore[react-devtools]: drop legacy context tests (#31059)

    We've dropped the support for detecting changes in legacy Contexts in
    #30896.
    hoxyq authored Oct 1, 2024
    Configuration menu
    Copy the full SHA
    6e61258 View commit details
    Browse the repository at this point in the history
  5. Disable infinite render loop detection (#31088)

    We're seeing issues with this feature internally including bugs with
    sibling prerendering and errors that are difficult for developers to
    action on. We'll turn off the feature for the time being until we can
    improve the stability and ergonomics.
    
    This PR does two things:
    - Turn off `enableInfiniteLoopDetection` everywhere while leaving it as
    a variant on www so we can do further experimentation.
    - Revert #31061 which was a
    temporary change for debugging. This brings the feature back to
    baseline.
    jackpope authored Oct 1, 2024
    Configuration menu
    Copy the full SHA
    d8c90fa View commit details
    Browse the repository at this point in the history
Loading