Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/facebook/react.git. Pull mirroring updated . This branch has diverged from upstream.
  1. Mar 05, 2025
  2. Mar 04, 2025
    • michael faith's avatar
      docs(eslint-plugin-react-hooks): clarify config details for prior versions (#32498) · 443b7ff2
      michael faith authored
      This change adds more details about prior versions of the plugin's
      config, to help people as they migrate from legacy to flat configs
      across multiple versions of this plugin. At some point in the 6.0 or 7.0
      cycle, it would probably make sense to re-consolidate this into a single
      version.
      
      Closes #32494
      443b7ff2
    • Jordan Brown's avatar
    • Jordan Brown's avatar
      [autodeps] Support namespaces (#32162) · bdce84a5
      Jordan Brown authored
      Summary: Correctly supports React.useEffect when React is
      imported as `import * as React from 'react'`
      (as well as other namespaces as specified in the config).
      bdce84a5
    • Jordan Brown's avatar
      [compiler][ez] Add validation for auto-deps config (#31813) · a1f157e9
      Jordan Brown authored
      numRequiredArgs has to be more than 0 and the pass depends on that
      
      --
      a1f157e9
    • Sebastian Markbåge's avatar
      Polyfill onScrollEnd Event in Safari (#32427) · 605a880c
      Sebastian Markbåge authored
      We added support for `onScrollEnd` in #26789 but it only works in Chrome
      and Firefox. Safari still doesn't support `scrollend` and there's no
      indication that they will anytime soon so this polyfills it.
      
      While I don't particularly love our synthetic event system this tries to
      stay within the realm of how our other polyfills work. This implements
      all `onScrollEnd` events as a plugin.
      
      The basic principle is to first feature detect the `onscrollend` DOM
      property to see if there's native support and otherwise just use the
      native event.
      
      Then we listen to `scroll` events and set a timeout. If we don't get any
      more scroll events before the timeout we fire `onScrollEnd`. Basically
      debouncing it. If we're currently pressing down on touch or a mouse then
      we wait until it is lifted such as if you're scrolling with a finger or
      using the scrollbars on desktop but isn't currently moving.
      
      If we do get any native events even though we're in polyfilling mode, we
      use that as an indication to fire the `onScrollEnd` early.
      
      Part of the motivation is that this becomes extra useful pair for
      https://github.com/facebook/react/pull/32422. We also probably need
      these events to coincide with other gesture related internals so you're
      better off using our polyfill so they're synced.
      605a880c
  3. Mar 02, 2025
  4. Mar 01, 2025
  5. Feb 28, 2025
    • lauren's avatar
      [ci] Upload release for easier debugging (#32492) · 56c7d107
      lauren authored
      Uploads the releases that were published in case to help with debugging
      or verifying a dry run.
      ---
      [//]: # (BEGIN SAPLING FOOTER)
      Stack created with [Sapling](https://sapling-scm.com). Best reviewed
      with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32492).
      * __->__ #32492
      * #32491
      56c7d107
    • lauren's avatar
      [ci] Fix discord notification title (#32491) · 7e2ea902
      lauren authored
      fun times
      ---
      [//]: # (BEGIN SAPLING FOOTER)
      Stack created with [Sapling](https://sapling-scm.com). Best reviewed
      with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32491).
      * #32492
      * __->__ #32491
      7e2ea902
    • Sebastian Markbåge's avatar
      Add Commit Scaffolding for Gestures (#32451) · 3607f483
      Sebastian Markbåge authored
      This adds a `ReactFiberApplyGesture` which is basically intended to be a
      fork of the phases in `ReactFiberCommitWork` except for the fake commit
      that `useSwipeTransition` does. So far none of the phases are actually
      implemented yet. This is just the scaffolding around them so I can fill
      them in later.
      
      The important bit is that we call `startViewTransition` (via the
      `startGestureTransition` Config) when a gesture starts. We add a paused
      animation to prevent the transition from committing (even if the
      ScrollTimeline goes to 100%). This also locks the documents so that we
      can't commit any other Transitions until it completes.
      
      When the gesture completes (scroll end) then we stop the gesture View
      Transition. If there's no new work scheduled we do that immediately but
      if there was any new work already scheduled, then we assume that this
      will potentially commit the new state. So we wait for that to finish.
      This lets us lock the animation in its state instead of snapping back
      and then applying the real update.
      
      Using this technique we can't actually run a View Transition from the
      current state to the actual committed state because it would snap back
      to the beginning and then run the View Transition from there. Therefore
      any new commit needs to skip View Transitions even if it should've
      technically animated to that state. We assume that the new state is the
      same as the optimistic state you already swiped to. An alternative to
      this technique could be to commit the optimistic state when we cancel
      and then apply any new updates o top of that. I might explore that in
      the future.
      
      Regardless it's important that the `action` associated with the swipe
      schedules some work before we cancel. Otherwise it risks reverting
      first. So I had to update this in the fixture.
      3607f483
    • lauren's avatar
      [ci] Fix --dry not being passed correctly (#32489) · 5eb20b30
      lauren authored
      Boolean params for dry runs are true if the param exists at all, so only
      add it if we're in dry run mode.
      5eb20b30
    • lauren's avatar
      [ci] Prepare publish workflow (#32488) · 4c9392b4
      lauren authored
      Fixes up a few things in the script and workflow to make it possible to
      run in CI without interactive prompts.
      4c9392b4
    • lauren's avatar
      [ci] Add workflow to publish releases (#32487) · 227e8414
      lauren authored
      Adds a new workflow to publish runtime releases from NPM. Note that I
      commented out the actual publish command so I can test it out first.
      227e8414
    • lauren's avatar
      [release] Update publishing scripts to make publishing allowlisted packages easier (#32486) · 2df96224
      lauren authored
      It's getting unwieldy to list every single package to skip in these
      commands when you only want to publish one, ie
      eslint-plugin-react-hooks.
      
      This adds a new `onlyPackages` and `publishVersion` option to the
      publish commands to make that easier.
      2df96224
  6. Feb 26, 2025
  7. Feb 25, 2025
  8. Feb 24, 2025
  9. Feb 22, 2025
    • Josh Story's avatar
      [Fizz] Responsive images should not be preloaded with link headers (#32445) · 9b042f9d
      Josh Story authored
      Link headers are optionally supported for cases where you prefer to send
      resource loading hints before you're ready to send the body of a
      request. While many resources can be correctly preloaded from a link
      header responsive images are currently not supported and end up
      preloading the default src rather than the correctly sized image. Until
      responsive images are supported React will not allow these images to
      preload as headers and will retain them to preload as HTML.
      
      closes: #32437
      9b042f9d
    • Sebastian Markbåge's avatar
      Add Example of a SwipeRecognizer (#32422) · 27ba5e8b
      Sebastian Markbåge authored
      Stacked on #32412.
      
      To effectively `useSwipeTransition` you need something to start and stop
      the gesture as well as triggering an Action.
      
      This adds an example Gesture Recognizer to the fixture. Instead of
      having this built-in to React itself, instead the idea is to leave this
      to various user space Component libraries. It can be done in different
      ways for different use cases. It could use JS driven or native
      ScrollTimeline or both.
      
      This example uses a native scroll with scroll snapping to two edges. If
      you swipe far enough to snap to the other edge, it triggers an Action at
      the end.
      
      This particular example uses a `position: sticky` to wrap the content of
      the Gesture Recognizer. This means that it's inert by itself. It doesn't
      scroll its content just like a plain JS recognizer using pointer events
      would. This is useful because it means that scrolling doesn't affect
      content before we start (the "scroll" event fires after scrolling has
      already started) so we don't have to both trying to start it earlier. It
      also means that scrolling doesn't affect the live content which can lead
      to unexpected effects on the View Transition.
      
      I find the inert recognizer the most useful pairing with
      `useSwipeTransition` but it's not the only way to do it. E.g. you can
      also have a scrollable surface that uses plain scrolling with snapping
      and then just progressively enhances swiping between steps.
      27ba5e8b
    • Sebastian Markbåge's avatar
      Allow passing range option to useSwipeTransition (#32412) · 662957cc
      Sebastian Markbåge authored
      Stacked on #32379
      
      Track the range offsets along the timeline where previous/current/next
      is. This can also be specified as an option. This lets you model more
      than three states along a timeline by clamping them and then updating
      the "current" as you go.
      
      It also allows specifying the "current" offset as something different
      than what it was when the gesture started such as if it has to start
      after scroll has already happened (such as what happens if you listen to
      the "scroll" event).
      662957cc
  10. Feb 21, 2025
    • Sebastian Markbåge's avatar
      Rerender useSwipeTransition when direction changes (#32379) · 88479c6f
      Sebastian Markbåge authored
      We can only render one direction at a time with View Transitions. When
      the direction changes we need to do another render in the new direction
      (returning previous or next).
      
      To determine direction we store the position we started at and anything
      moving to a lower value (left/up) is "previous" direction (`false`) and
      anything else is "next" (`true`) direction.
      
      For the very first render we won't know which direction you're going
      since you're still on the initial position. It's useful to start the
      render to allow the view transition to take control before anything
      shifts around so we start from the original position. This is not
      guaranteed though if the render suspends.
      
      For now we start the first render by guessing the direction such as if
      we know that prev/next are the same as current. With the upcoming auto
      start mode we can guess more accurately there before we start. We can
      also add explicit APIs to `startGesture` but ideally it wouldn't matter.
      Ideally we could just start after the first change in direction from the
      starting point.
      88479c6f
    • Sam Zhou's avatar
    • Jack Pope's avatar
      Revert "Ship enableFabricCompleteRootInCommitPhase (#32318)" (#32434) · 885532c1
      Jack Pope authored
      This reverts commit 8759c5c8 /
      https://github.com/facebook/react/pull/32318
      
      We discovered that the experiment setup for this was faulty and we need
      to re-run as a back test.
      885532c1
    • mofeiZ's avatar
      [compiler][playground] Upgrade to Next 15.2.0-canary.64 (#32428) · 5f31228d
      mofeiZ authored
      Upgrade compiler playground to use the newest nextjs release, which
      includes react compiler transform pipeline optimizations
      https://github.com/vercel/next.js/pull/75676/.
      
      Also made a drive-by fix to avoid the error `Cannot update a component
      ('Router') while rendering a different component ('StoreProvider'). To
      locate the bad setState() call inside 'StoreProvider', follow the stack
      trace as described in https://react.dev/link/setstate-in-render`. The
      bad setState came from `history.replaceState({}, '', \`#${hash}\`);`.
      
      Prior to this, playground ran side effects in a reducer (i.e. during
      render). These have now been moved an effect.
      5f31228d
  11. Feb 20, 2025
  12. Feb 19, 2025
    • lauren's avatar
      [eslint] Target ES5 (#32420) · a84862db
      lauren authored
      Update eslint-plugin-react-hooks to be built targetting ES5 instead. For
      various reasons our internal infra relies on these files being built
      already downleveled.
      a84862db
    • mofeiZ's avatar
      [compiler][be] Clean up bug test fixtures; evaluate more fixtures (#31812) · 86b19134
      mofeiZ authored
      Test fixtures testing different compiler features (e.g. non-auto
      memoization) should live in separate directories.
      
      Remove bug-prefixed fixtures that have since been fixed
      
      Add test evaluator export to more fixtures
      86b19134