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: 313332d1
Choose a base ref
...
head repository: react/react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4280563b
Choose a head ref
  • 9 commits
  • 46 files changed
  • 4 contributors

Commits on Mar 26, 2025

  1. [ci] Skip yarn install on cache hit (#32757)

    We currently already do this in runtime_build_and_test, we can reuse the
    same technique in other workflows to speed them up.
    poteto authored Mar 26, 2025
    Configuration menu
    Copy the full SHA
    5f232d7 View commit details
    Browse the repository at this point in the history
  2. [compiler][be] Test runner (snap) now uses tsup bundled plugin (#32758)

    Currently, `babel-plugin-react-compiler` is bundled with (almost) all
    external dependencies. This is because babel traversal and ast logic is
    not forward-compatible. Since `babel-plugin-react-compiler` needs to be
    compatible with babel pipelines across a wide semvar range, we (1) set
    this package's babel dependency to an early version and (2) inline babel
    libraries into our bundle.
    
    A few other packages in `react/compiler` depend on the compiler. This PR
    moves `snap`, our test fixture compiler and evaluator, to use the
    bundled version of `babel-plugin-react-compiler`. This decouples the
    babel version used by `snap` with the version used by
    `babel-plugin-react-compiler`, which means that `snap` now can test
    features from newer babel versions (see
    #32742).
    
    ---
    [//]: # (BEGIN SAPLING FOOTER)
    Stack created with [Sapling](https://sapling-scm.com). Best reviewed
    with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32758).
    * #32759
    * __->__ #32758
    mofeiZ authored Mar 26, 2025
    Configuration menu
    Copy the full SHA
    33999c4 View commit details
    Browse the repository at this point in the history
  3. [compiler][be] Playground now uses tsup bundled plugin (#32759)

    Followup to #32758.
    
    This moves playground to use the tsup bundled plugin instead of
    webpack-built `babel-plugin-react-compiler`.
    
    ---
    [//]: # (BEGIN SAPLING FOOTER)
    Stack created with [Sapling](https://sapling-scm.com). Best reviewed
    with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32759).
    * __->__ #32759
    * #32758
    mofeiZ authored Mar 26, 2025
    Configuration menu
    Copy the full SHA
    2541146 View commit details
    Browse the repository at this point in the history
  4. Don't flush synchronous work if we're in the middle of a ViewTransiti…

    …on async sequence (#32760)
    
    Starting a View Transition is an async sequence. Since React can get a
    sync update in the middle of sequence we sometimes interrupt that
    sequence.
    
    Currently, we don't actually cancel the View Transition so it can just
    run as a partial. This ensures that we fully skip it when that happens,
    as well as warn.
    
    However, it's very easy to trigger this with just a setState in
    useLayoutEffect right now. Therefore if we're inside the preparing
    sequence of a startViewTransition, this delays work that would've
    normally flushed in a microtask. ~Maybe we want to do the same for
    Default work already scheduled through a scheduler Task.~ Edit: This was
    already done.
    
    `flushSync` currently will still lead to an interrupted View Transition
    (with a warning). There's a tradeoff here whether we want to try our
    best to preserve the guarantees of `flushSync` or favor the animation.
    It's already possible to suspend at the root with `flushSync` which
    means it's not always 100% guaranteed to commit anyway. We could treat
    it as suspended. But let's see how much this is a problem in practice.
    sebmarkbage authored Mar 26, 2025
    Configuration menu
    Copy the full SHA
    a5297ec View commit details
    Browse the repository at this point in the history
  5. Rename <ViewTransition className="..."> to <ViewTransition default=".…

    ….."> (#32734)
    
    It was always confusing that this is not a CSS class but a
    view-transition-class.
    
    The `className` sticks out a bit among its siblings `enter`, `exit`,
    `update` and `share`. The idea is that the most specific definition
    override is the class name that gets applied and this prop is really
    just the fallback, catch-all or "any" that is applied if you didn't
    specify a more specific one.
    
    It has also since evolved not just to take a string but also a map of
    Transition Type to strings.
    
    The "class" is really the type of the value. We could add a suffix to
    all of them like `defaultClass`, `enterClass`, `exitClass`,
    `updateClass` and `shareClass`. However, this doesn't necessarily make
    sense with the mapping of Transition Type to string. It also makes it a
    bit too DOM centric. In React Native this might still be called a
    "class" but it might be represented by an object definition. We might
    even allow some kind of inline style form for the DOM too. Really this
    is about picking which "animation" that runs which can be a string or
    instance. "Animation" is too broad because there's also a concept of a
    CSS Animation and these are really sets of CSS animations (group,
    image-pair, old, new). It could maybe be `defaultTransition`,
    `enterTransition`, etc but that seems unnecessarily repetitive and still
    doesn't say anything about it being a class.
    
    We also already have the name "default" in the map of Transition Types.
    In fact you can now specify a default for default:
    
    ```
    <ViewTransition default={{"navigation-back": "slide-out", "default": "fade-in"}}>
    ```
    
    One thing I don't like about the name `"default"` is that it might be
    common to just apply a named class that does it matching to
    enter/exit/update in the CSS selectors (such as the `:only-child` rule)
    instead of doing that mapping to each one using React. In that can you
    end up specifying only `default={...}` a lot and then what is it the
    "default" for? It's more like "all". I think it's likely that you end up
    with either "default" or the specific forms instead of both at once.
    sebmarkbage authored Mar 26, 2025
    Configuration menu
    Copy the full SHA
    e0c99c4 View commit details
    Browse the repository at this point in the history
  6. Add "auto" class to mean the built-in should run (#32761)

    Stacked on #32734
    
    In React a ViewTransition class of `"none"` doesn't just mean that it
    has no class but also that it has no ViewTransition name. The default
    (`null | undefined`) means that it has no specific class but should run
    with the default built-in animation. This adds this as an explicit
    string called `"auto"` as well.
    
    That way you can do `<ViewTransition default="foo" enter="auto">` to
    override the "foo" just for the "enter" trigger to be the default
    built-in animation. Where as if you just specified `null` it would be
    like not specifying enter at all which would trigger "foo".
    sebmarkbage authored Mar 26, 2025
    Configuration menu
    Copy the full SHA
    fceb0f8 View commit details
    Browse the repository at this point in the history
  7. Add getComputedStyle helper to ViewTransition refs (#32751)

    This is also sometimes useful to read the style of the pseudo-element
    itself without an animation.
    sebmarkbage authored Mar 26, 2025
    Configuration menu
    Copy the full SHA
    f134b39 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3e88e97 View commit details
    Browse the repository at this point in the history
  9. Mark shouldStartViewTransition as true when there's an enter animation (

    #32764)
    
    Typically we mark the name of things that might animate in the snapshot
    phase. At the same time we track that should call startViewTransition
    too. However, we don't do this for "enter" since they're only marked
    later. Leading to having just an "enter" not to animate unless there's
    at least another update too.
    
    This tracks if there's a ViewTransitionComponent in the tree that
    enters. Luckily we know that from the static flag so we don't have to
    traverse it.
    sebmarkbage authored Mar 26, 2025
    Configuration menu
    Copy the full SHA
    4280563 View commit details
    Browse the repository at this point in the history
Loading