GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com (truncated) — Switch <Context> to mean <Context.Provider> by gaearon · Pull Request #28226 · react/react

Conversation

@gaearon

@gaearon gaearon commented Feb 3, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Previously, <Context> was equivalent to <Context.Consumer>. However, since the introduction of Hooks, the <Context.Consumer> API is rarely used. The goal here is to make the common case cleaner:

const ThemeContext = createContext('light')

function App() {
  return (
    <ThemeContext value="dark">
      ...
    </ThemeContext>
  )
}

function Button() {
  const theme = use(ThemeContext)
  // ...
}

This is technically a breaking change, but we've been warning about rendering <Context> directly for several years by now, so it's unlikely much code in the wild depends on the old behavior. Proof that it warns today (check console).


The relevant commit is 5696782. It switches createContext implementation so that Context.Provider === Context.

The main assumption that changed is that a Provider's fiber type is now the context itself (rather than an intermediate object). Whereas a Consumer's fiber type is now always an intermediate object (rather than it being sometimes the context itself and sometimes an intermediate object).

My methodology was to start with the relevant symbols, work tags, and types, and work my way backwards to all usages.

This might break tooling that depends on inspecting React's internal fields. I've added DevTools support in the second commit. This didn't need explicit versioning—the structure tells us enough.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sadeghbarati, emrerdem1, thetrompf, crutchcorn, YannBirba, diegohaz, jhb-dev, 4ndrs, KidkArolis, fdaciuk, and 18 more reacted with heart emoji
All reactions
  • ❤️ 28 reactions
@facebook-github-bot facebook-github-bot added the CLA Signed label Feb 3, 2024
@gaearon
gaearon force-pushed the renderable-context branch from 400adc8 to 8f41e98 Compare February 3, 2024 19:09
@react-sizebot

react-sizebot commented Feb 3, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: 35b2c28...c86765f

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js +0.02% 176.82 kB 176.86 kB = 55.12 kB 55.12 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js +0.02% 178.81 kB 178.85 kB = 55.70 kB 55.69 kB
facebook-www/ReactDOM-prod.classic.js +0.25% 593.39 kB 594.89 kB +0.22% 104.69 kB 104.92 kB
facebook-www/ReactDOM-prod.modern.js +0.17% 577.17 kB 578.18 kB +0.15% 101.78 kB 101.94 kB
facebook-www/ReactIs-dev.modern.js +13.56% 7.30 kB 8.29 kB +8.20% 1.82 kB 1.97 kB
facebook-www/ReactIs-dev.classic.js +13.56% 7.30 kB 8.29 kB +8.36% 1.82 kB 1.97 kB
facebook-www/ReactIs-prod.classic.js +13.36% 5.14 kB 5.83 kB +7.67% 1.26 kB 1.36 kB
facebook-www/ReactIs-prod.modern.js +13.36% 5.14 kB 5.83 kB +7.67% 1.26 kB 1.36 kB
oss-stable-semver/react-is/cjs/react-is.production.js +5.92% 6.25 kB 6.62 kB +4.89% 1.72 kB 1.80 kB
oss-stable/react-is/cjs/react-is.production.js +5.92% 6.25 kB 6.62 kB +4.89% 1.72 kB 1.80 kB
oss-experimental/react-is/cjs/react-is.production.js +5.90% 6.28 kB 6.65 kB +4.82% 1.72 kB 1.81 kB
oss-stable-semver/react-is/cjs/react-is.development.js +5.84% 6.27 kB 6.63 kB +4.66% 1.76 kB 1.84 kB
oss-stable/react-is/cjs/react-is.development.js +5.84% 6.27 kB 6.63 kB +4.66% 1.76 kB 1.84 kB
oss-experimental/react-is/cjs/react-is.development.js +5.82% 6.29 kB 6.66 kB +4.71% 1.76 kB 1.85 kB
facebook-react-native/react-is/cjs/ReactIs-dev.js +5.81% 6.87 kB 7.26 kB +4.69% 1.75 kB 1.83 kB
oss-stable-semver/react-is/umd/react-is.development.js +5.72% 6.82 kB 7.21 kB +4.53% 1.85 kB 1.94 kB
oss-stable/react-is/umd/react-is.development.js +5.72% 6.82 kB 7.21 kB +4.53% 1.85 kB 1.94 kB
oss-experimental/react-is/umd/react-is.development.js +5.70% 6.84 kB 7.23 kB +4.52% 1.86 kB 1.94 kB
facebook-react-native/react-is/cjs/ReactIs-prod.js +2.77% 4.52 kB 4.64 kB +1.24% 1.13 kB 1.14 kB
facebook-react-native/react-is/cjs/ReactIs-profiling.js +2.77% 4.52 kB 4.64 kB +1.24% 1.13 kB 1.14 kB
oss-stable-semver/react-is/cjs/react-is.production.min.js +2.17% 2.16 kB 2.21 kB +1.44% 0.76 kB 0.77 kB
oss-stable/react-is/cjs/react-is.production.min.js +2.17% 2.16 kB 2.21 kB +1.44% 0.76 kB 0.77 kB
oss-experimental/react-is/cjs/react-is.production.min.js +2.14% 2.20 kB 2.24 kB +1.56% 0.77 kB 0.78 kB
oss-experimental/react-is/umd/react-is.production.min.js +2.12% 2.26 kB 2.31 kB +1.17% 0.85 kB 0.86 kB
oss-stable-semver/react-is/umd/react-is.production.min.js +2.11% 2.23 kB 2.28 kB +1.18% 0.84 kB 0.85 kB
oss-stable/react-is/umd/react-is.production.min.js +2.11% 2.23 kB 2.28 kB +1.18% 0.84 kB 0.85 kB
test_utils/ReactAllWarnings.js Deleted 67.02 kB 0.00 kB Deleted 16.42 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
facebook-www/ReactIs-dev.modern.js +13.56% 7.30 kB 8.29 kB +8.20% 1.82 kB 1.97 kB
facebook-www/ReactIs-dev.classic.js +13.56% 7.30 kB 8.29 kB +8.36% 1.82 kB 1.97 kB
facebook-www/ReactIs-prod.classic.js +13.36% 5.14 kB 5.83 kB +7.67% 1.26 kB 1.36 kB
facebook-www/ReactIs-prod.modern.js +13.36% 5.14 kB 5.83 kB +7.67% 1.26 kB 1.36 kB
oss-stable-semver/react-is/cjs/react-is.production.js +5.92% 6.25 kB 6.62 kB +4.89% 1.72 kB 1.80 kB
oss-stable/react-is/cjs/react-is.production.js +5.92% 6.25 kB 6.62 kB +4.89% 1.72 kB 1.80 kB
oss-experimental/react-is/cjs/react-is.production.js +5.90% 6.28 kB 6.65 kB +4.82% 1.72 kB 1.81 kB
oss-stable-semver/react-is/cjs/react-is.development.js +5.84% 6.27 kB 6.63 kB +4.66% 1.76 kB 1.84 kB
oss-stable/react-is/cjs/react-is.development.js +5.84% 6.27 kB 6.63 kB +4.66% 1.76 kB 1.84 kB
oss-experimental/react-is/cjs/react-is.development.js +5.82% 6.29 kB 6.66 kB +4.71% 1.76 kB 1.85 kB
facebook-react-native/react-is/cjs/ReactIs-dev.js +5.81% 6.87 kB 7.26 kB +4.69% 1.75 kB 1.83 kB
oss-stable-semver/react-is/umd/react-is.development.js +5.72% 6.82 kB 7.21 kB +4.53% 1.85 kB 1.94 kB
oss-stable/react-is/umd/react-is.development.js +5.72% 6.82 kB 7.21 kB +4.53% 1.85 kB 1.94 kB
oss-experimental/react-is/umd/react-is.development.js +5.70% 6.84 kB 7.23 kB +4.52% 1.86 kB 1.94 kB
facebook-react-native/react-is/cjs/ReactIs-prod.js +2.77% 4.52 kB 4.64 kB +1.24% 1.13 kB 1.14 kB
facebook-react-native/react-is/cjs/ReactIs-profiling.js +2.77% 4.52 kB 4.64 kB +1.24% 1.13 kB 1.14 kB
oss-stable-semver/react-is/cjs/react-is.production.min.js +2.17% 2.16 kB 2.21 kB +1.44% 0.76 kB 0.77 kB
oss-stable/react-is/cjs/react-is.production.min.js +2.17% 2.16 kB 2.21 kB +1.44% 0.76 kB 0.77 kB
oss-experimental/react-is/cjs/react-is.production.min.js +2.14% 2.20 kB 2.24 kB +1.56% 0.77 kB 0.78 kB
oss-experimental/react-is/umd/react-is.production.min.js +2.12% 2.26 kB 2.31 kB +1.17% 0.85 kB 0.86 kB
oss-stable-semver/react-is/umd/react-is.production.min.js +2.11% 2.23 kB 2.28 kB +1.18% 0.84 kB 0.85 kB
oss-stable/react-is/umd/react-is.production.min.js +2.11% 2.23 kB 2.28 kB +1.18% 0.84 kB 0.85 kB
facebook-www/React-prod.modern.js +1.87% 18.83 kB 19.18 kB +1.14% 4.81 kB 4.87 kB
facebook-www/React-prod.classic.js +1.85% 19.12 kB 19.48 kB +1.16% 4.90 kB 4.95 kB
facebook-www/React-profiling.modern.js +1.83% 19.26 kB 19.62 kB +1.14% 4.89 kB 4.95 kB
facebook-www/React-profiling.classic.js +1.80% 19.56 kB 19.91 kB +1.10% 4.98 kB 5.04 kB
facebook-www/JSXDEVRuntime-dev.modern.js +1.47% 53.39 kB 54.17 kB +0.81% 13.89 kB 14.00 kB
facebook-www/JSXDEVRuntime-dev.classic.js +1.47% 53.39 kB 54.17 kB +0.81% 13.88 kB 14.00 kB
oss-experimental/react-reconciler/cjs/react-reconciler-reflection.development.js +1.43% 18.55 kB 18.81 kB +1.01% 5.35 kB 5.41 kB
oss-stable-semver/react-reconciler/cjs/react-reconciler-reflection.development.js +1.43% 18.55 kB 18.81 kB +1.01% 5.35 kB 5.41 kB
oss-stable/react-reconciler/cjs/react-reconciler-reflection.development.js +1.43% 18.55 kB 18.81 kB +1.01% 5.35 kB 5.41 kB
facebook-react-native/react/cjs/JSXDEVRuntime-dev.js +0.76% 40.12 kB 40.43 kB +0.55% 10.54 kB 10.60 kB
facebook-react-native/react/cjs/JSXRuntime-dev.js +0.75% 40.79 kB 41.09 kB +0.64% 10.72 kB 10.79 kB
facebook-www/ReactServer-dev.modern.js +0.72% 108.86 kB 109.64 kB +0.45% 26.40 kB 26.52 kB
oss-experimental/react/cjs/react-jsx-dev-runtime.development.js +0.63% 45.90 kB 46.19 kB +0.48% 13.40 kB 13.46 kB
oss-stable-semver/react/cjs/react-jsx-dev-runtime.development.js +0.63% 45.93 kB 46.22 kB +0.48% 13.40 kB 13.47 kB
oss-stable/react/cjs/react-jsx-dev-runtime.development.js +0.63% 45.93 kB 46.22 kB +0.48% 13.40 kB 13.47 kB
oss-experimental/react/cjs/react-jsx-runtime.development.js +0.62% 46.50 kB 46.79 kB +0.47% 13.57 kB 13.63 kB
oss-stable-semver/react/cjs/react-jsx-runtime.development.js +0.62% 46.52 kB 46.81 kB +0.47% 13.58 kB 13.64 kB
oss-stable/react/cjs/react-jsx-runtime.development.js +0.62% 46.52 kB 46.81 kB +0.47% 13.58 kB 13.64 kB
oss-experimental/react/cjs/react-jsx-runtime.react-server.development.js +0.62% 46.58 kB 46.87 kB +0.46% 13.61 kB 13.67 kB
oss-stable-semver/react/cjs/react-jsx-runtime.react-server.development.js +0.62% 46.61 kB 46.90 kB +0.47% 13.61 kB 13.68 kB
oss-stable/react/cjs/react-jsx-runtime.react-server.development.js +0.62% 46.61 kB 46.90 kB +0.47% 13.61 kB 13.68 kB
facebook-www/ReactART-prod.classic.js +0.41% 363.53 kB 365.03 kB +0.32% 61.70 kB 61.89 kB
facebook-www/ReactDOMServer-prod.modern.js +0.40% 202.71 kB 203.53 kB +0.52% 36.74 kB 36.94 kB
facebook-www/ReactDOMServer-prod.classic.js +0.40% 203.88 kB 204.69 kB +0.50% 37.03 kB 37.22 kB
facebook-www/ReactDOMServerStreaming-prod.modern.js +0.38% 206.61 kB 207.40 kB +0.37% 38.14 kB 38.29 kB
oss-stable-semver/react/cjs/react.react-server.development.js +0.37% 78.08 kB 78.37 kB +0.31% 21.52 kB 21.59 kB
oss-stable/react/cjs/react.react-server.development.js +0.37% 78.10 kB 78.39 kB +0.32% 21.55 kB 21.62 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.development.js +0.37% 25.26 kB 25.35 kB +0.33% 6.76 kB 6.78 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.development.js +0.37% 25.26 kB 25.35 kB +0.33% 6.76 kB 6.78 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.development.js +0.37% 25.26 kB 25.35 kB +0.33% 6.76 kB 6.78 kB
oss-experimental/react-debug-tools/cjs/react-debug-tools.production.min.js +0.35% 7.83 kB 7.85 kB +0.32% 2.82 kB 2.83 kB
oss-stable-semver/react-debug-tools/cjs/react-debug-tools.production.min.js +0.35% 7.83 kB 7.85 kB +0.32% 2.82 kB 2.83 kB
oss-stable/react-debug-tools/cjs/react-debug-tools.production.min.js +0.35% 7.83 kB 7.85 kB +0.32% 2.82 kB 2.83 kB
oss-experimental/react/cjs/react.react-server.development.js +0.34% 84.53 kB 84.82 kB +0.30% 23.41 kB 23.48 kB
facebook-www/ReactART-prod.modern.js +0.29% 352.57 kB 353.58 kB +0.27% 59.71 kB 59.88 kB
facebook-www/ReactDOM-prod.classic.js +0.25% 593.39 kB 594.89 kB +0.22% 104.69 kB 104.92 kB
oss-stable-semver/react-server/cjs/react-server.production.js +0.25% 155.57 kB 155.95 kB +0.26% 36.61 kB 36.71 kB
oss-stable/react-server/cjs/react-server.production.js +0.25% 155.57 kB 155.95 kB +0.26% 36.61 kB 36.71 kB
facebook-www/ReactDOMTesting-prod.classic.js +0.25% 608.17 kB 609.67 kB +0.20% 108.38 kB 108.59 kB
facebook-www/ReactDOM-profiling.classic.js +0.24% 623.82 kB 625.33 kB +0.21% 109.23 kB 109.46 kB
oss-experimental/react-server/cjs/react-server.production.js +0.23% 167.06 kB 167.45 kB +0.25% 38.54 kB 38.64 kB
facebook-www/ReactDOMTesting-prod.modern.js +0.22% 593.55 kB 594.86 kB +0.18% 105.89 kB 106.08 kB
oss-experimental/react-dom/umd/react-dom-server.browser.development.js = 464.86 kB 463.92 kB = 99.50 kB 99.22 kB
oss-experimental/react-dom/umd/react-dom-server-legacy.browser.development.js = 455.58 kB 454.64 kB = 98.33 kB 98.05 kB
oss-experimental/react-dom/cjs/react-dom-server.edge.development.js = 444.87 kB 443.94 kB = 98.63 kB 98.35 kB
oss-experimental/react-dom/cjs/react-dom-server.browser.development.js = 444.29 kB 443.36 kB = 98.49 kB 98.21 kB
oss-experimental/react-dom/cjs/react-dom-server.node.development.js = 442.72 kB 441.79 kB = 97.72 kB 97.43 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.node.development.js = 437.27 kB 436.34 kB = 97.85 kB 97.57 kB
oss-experimental/react-dom/cjs/react-dom-server-legacy.browser.development.js = 435.41 kB 434.49 kB = 97.39 kB 97.10 kB
oss-stable/react-dom/umd/react-dom-server-legacy.browser.development.js = 440.90 kB 439.97 kB = 96.04 kB 95.75 kB
oss-stable-semver/react-dom/umd/react-dom-server-legacy.browser.development.js = 440.88 kB 439.94 kB = 96.02 kB 95.73 kB
oss-stable/react-dom/umd/react-dom-server.browser.development.js = 440.43 kB 439.49 kB = 96.22 kB 95.94 kB
oss-stable-semver/react-dom/umd/react-dom-server.browser.development.js = 440.41 kB 439.47 kB = 96.20 kB 95.91 kB
oss-experimental/react-dom/cjs/react-dom-server.bun.development.js = 429.11 kB 428.18 kB = 95.43 kB 95.14 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.node.development.js = 423.18 kB 422.25 kB = 95.54 kB 95.24 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.node.development.js = 423.15 kB 422.23 kB = 95.52 kB 95.22 kB
oss-stable/react-dom/cjs/react-dom-server.edge.development.js = 421.45 kB 420.52 kB = 95.38 kB 95.09 kB
oss-stable-semver/react-dom/cjs/react-dom-server.edge.development.js = 421.42 kB 420.50 kB = 95.36 kB 95.07 kB
oss-stable/react-dom/cjs/react-dom-server-legacy.browser.development.js = 421.32 kB 420.40 kB = 95.07 kB 94.78 kB
oss-stable-semver/react-dom/cjs/react-dom-server-legacy.browser.development.js = 421.30 kB 420.37 kB = 95.05 kB 94.75 kB
oss-stable/react-dom/cjs/react-dom-server.browser.development.js = 420.86 kB 419.94 kB = 95.25 kB 94.95 kB
oss-stable-semver/react-dom/cjs/react-dom-server.browser.development.js = 420.84 kB 419.91 kB = 95.22 kB 94.93 kB
oss-stable/react-dom/cjs/react-dom-server.node.development.js = 419.83 kB 418.90 kB = 94.19 kB 93.90 kB
oss-stable-semver/react-dom/cjs/react-dom-server.node.development.js = 419.80 kB 418.87 kB = 94.17 kB 93.87 kB
oss-stable/react-dom/cjs/react-dom-server.bun.development.js = 415.02 kB 414.09 kB = 93.11 kB 92.81 kB
oss-stable-semver/react-dom/cjs/react-dom-server.bun.development.js = 414.99 kB 414.07 kB = 93.09 kB 92.79 kB
oss-experimental/react-server/cjs/react-server.development.js = 210.56 kB 209.63 kB = 49.00 kB 48.72 kB
oss-stable-semver/react-server/cjs/react-server.development.js = 199.10 kB 198.17 kB = 47.09 kB 46.80 kB
oss-stable/react-server/cjs/react-server.development.js = 199.10 kB 198.17 kB = 47.09 kB 46.80 kB
facebook-www/React-dev.classic.js = 142.40 kB 141.16 kB = 34.57 kB 34.29 kB
facebook-www/React-dev.modern.js = 141.18 kB 139.94 kB = 34.33 kB 34.03 kB
oss-experimental/react/umd/react.development.js = 128.09 kB 126.47 kB = 32.73 kB 32.38 kB
oss-stable/react/umd/react.development.js = 125.44 kB 123.82 kB = 32.04 kB 31.69 kB
oss-stable-semver/react/umd/react.development.js = 125.42 kB 123.80 kB = 32.01 kB 31.67 kB
facebook-react-native/react/cjs/React-dev.js = 128.36 kB 126.45 kB = 31.00 kB 30.61 kB
oss-experimental/react/cjs/react.development.js = 104.91 kB 103.31 kB = 27.97 kB 27.64 kB
oss-stable/react/cjs/react.development.js = 102.37 kB 100.78 kB = 27.33 kB 26.99 kB
oss-stable-semver/react/cjs/react.development.js = 102.34 kB 100.75 kB = 27.30 kB 26.96 kB
test_utils/ReactAllWarnings.js Deleted 67.02 kB 0.00 kB Deleted 16.42 kB 0.00 kB

Generated by 🚫 dangerJS against c86765f

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gaearon
gaearon force-pushed the renderable-context branch 6 times, most recently from 01a1ac8 to 24b0d33 Compare February 3, 2024 19:46
@gaearon
gaearon requested review from acdlite, hoxyq and sebmarkbage February 3, 2024 19:51
@gaearon
gaearon force-pushed the renderable-context branch from bac2803 to 9c224c7 Compare February 3, 2024 20:36
gaearon
gaearon commented Feb 3, 2024
View reviewed changes
Comment thread packages/shared/ReactSymbols.js
export const REACT_PROFILER_TYPE: symbol = Symbol.for('react.profiler');
export const REACT_PROVIDER_TYPE: symbol = Symbol.for('react.provider');
export const REACT_CONSUMER_TYPE: symbol = Symbol.for('react.consumer');
export const REACT_CONTEXT_TYPE: symbol = Symbol.for('react.context');

@gaearon gaearon Feb 3, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the crux of the change.

Providers shifted from REACT_PROVIDER_TYPE (deleted) to REACT_CONTEXT_TYPE.

Consumers shifted from REACT_CONTEXT_TYPE to REACT_CONSUMER_TYPE (new).

This lets us avoid changing anything about use(Foo) or contextType = Foo and only change how we map a Fiber type to the underlying context.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Jacksonmills reacted with eyes emoji
All reactions
  • 👀 1 reaction
@gaearon
gaearon force-pushed the renderable-context branch 3 times, most recently from da25659 to 87624dc Compare February 5, 2024 22:44
gnoff
gnoff approved these changes Feb 5, 2024
View reviewed changes

@gnoff gnoff left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's hold on merging til we confirm we can but excited for this change

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/shared/getComponentNameFromType.js Outdated
case REACT_PROVIDER_TYPE:
const provider: ReactProviderType<any> = (type: any);
return getContextName(provider._context) + '.Provider';
return getContextName(context) + '.Provider';

@gnoff gnoff Feb 5, 2024

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine we'll be in a world soon where you never think about .Provider and just assume rendering a context provides values and "using" a context reads values. In this context does it make sense for the component name to carry forward this notion of .Provider? or should we switch it and call FooContext.Provider FooContext instead of calling FooContext FooContext.Provider?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@gaearon gaearon Feb 6, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yea, I'd be happy to drop but figured it might invalidate snapshot tests or stuff like this. Maybe as a separate change later if this one settles?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
hoxyq
hoxyq reviewed Feb 7, 2024
View reviewed changes
Comment thread packages/react-debug-tools/src/ReactDebugHooks.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@gaearon
gaearon force-pushed the renderable-context branch from 87624dc to 8726416 Compare February 11, 2024 00:05
gaearon added 2 commits February 11, 2024 01:17
@gaearon
Switch <Context> to mean <Context.Provider>
30ad348
@gaearon
Fix DevTools
0b14570
@gaearon
gaearon force-pushed the renderable-context branch from 8726416 to b122abd Compare February 11, 2024 01:31
gaearon
gaearon commented Feb 11, 2024
View reviewed changes
Comment thread packages/react-debug-tools/src/ReactDebugHooks.js
if ((context: any)._context !== undefined) {
// Support inspection of pre-19+ providers.
context = (context: any)._context;
}

@gaearon gaearon Feb 11, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this isn't feature-flagged because it needs to support both.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gaearon
gaearon force-pushed the renderable-context branch 4 times, most recently from 45d611b to 58c9942 Compare February 11, 2024 01:54
gaearon
gaearon commented Feb 11, 2024
View reviewed changes
Comment thread packages/react-server/src/ReactFizzServer.js
context: ReactContext<any>,
props: Object,
): void {
const context = type._context;

@gaearon gaearon Feb 11, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to the callsite.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gaearon
gaearon commented Feb 11, 2024
View reviewed changes
Comment thread packages/react-server/src/ReactFizzServer.js
context: ReactContext<any>,
props: Object,
): void {
// The logic below for Context differs depending on PROD or DEV mode. In

@gaearon gaearon Feb 11, 2024

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to the callsite.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gaearon
gaearon force-pushed the renderable-context branch from 01168df to c86765f Compare February 11, 2024 02:16
@gaearon

gaearon commented Feb 11, 2024

Copy link
Copy Markdown
Collaborator Author

Rebased and added a feature flag. I didn't keep the old warnings but I did preserve the codepaths and data structures to make it safer to land. The feature flag is hardcoded false everywhere except www where it's dynamic.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rickhanlonii
rickhanlonii merged commit 14fd963 into main Feb 13, 2024
@rickhanlonii
rickhanlonii deleted the renderable-context branch February 13, 2024 15:04
github-actions Bot pushed a commit that referenced this pull request Feb 13, 2024
@rickhanlonii
Switch <Context> to mean <Context.Provider> (#28226)
1985f4f
Previously, `<Context>` was equivalent to `<Context.Consumer>`. However,
since the introduction of Hooks, the `<Context.Consumer>` API is rarely
used. The goal here is to make the common case cleaner:

```js
const ThemeContext = createContext('light')

function App() {
  return (
    <ThemeContext value="dark">
      ...
    </ThemeContext>
  )
}

function Button() {
  const theme = use(ThemeContext)
  // ...
}
```

This is technically a breaking change, but we've been warning about
rendering `<Context>` directly for several years by now, so it's
unlikely much code in the wild depends on the old behavior. [Proof that
it warns today (check
console).](https://codesandbox.io/p/sandbox/peaceful-nobel-pdxtfl)

---

**The relevant commit is 5696782.** It
switches `createContext` implementation so that `Context.Provider ===
Context`.

The main assumption that changed is that a Provider's fiber type is now
the context itself (rather than an intermediate object). Whereas a
Consumer's fiber type is now always an intermediate object (rather than
it being sometimes the context itself and sometimes an intermediate
object).

My methodology was to start with the relevant symbols, work tags, and
types, and work my way backwards to all usages.

This might break tooling that depends on inspecting React's internal
fields. I've added DevTools support in the second commit. This didn't
need explicit versioning—the structure tells us enough.

DiffTrain build for [14fd963](14fd963)
This was referenced Feb 20, 2024
Bump vendored react versions vercel/next.js#62302
Closed
Upgrade vendored react vercel/next.js#62326
Merged
@hoxyq hoxyq mentioned this pull request Feb 22, 2024
React DevTools 5.0.0 -> 5.0.1 #28418
Merged
hoxyq added a commit that referenced this pull request Feb 22, 2024
@hoxyq
React DevTools 5.0.0 -> 5.0.1 (#28418)
288cf74
Full list of changes (not a public CHANGELOG):

* feature[REMOVED][devtools]: turn off / hide location based component
filters ([hoxyq](https://github.com/hoxyq) in
[#28417](#28417))
* Add useSyncExternalStore and useTransition to getPrimitiveStackCache
([jamesbvaughan](https://github.com/jamesbvaughan) in
[#28399](#28399))
* chore[devtools]: use react-window from npm and bump
react-virtualized-auto-sizer to ^1.0.23
([hoxyq](https://github.com/hoxyq) in
[#28408](#28408))
* Pass ref as normal prop ([acdlite](https://github.com/acdlite) in
[#28348](#28348))
* Combine createElement and JSX modules
([acdlite](https://github.com/acdlite) in
[#28320](#28320))
* [Debug Tools] Always use includeHooksSource option
([sebmarkbage](https://github.com/sebmarkbage) in
[#28309](#28309))
* Revert "[Tests] Reset modules by default"
([acdlite](https://github.com/acdlite) in
[#28318](#28318))
* Switch <Context> to mean <Context.Provider>
([gaearon](https://github.com/gaearon) in
[#28226](#28226))
* [Debug Tools] Introspect Promises in use()
([sebmarkbage](https://github.com/sebmarkbage) in
[#28297](#28297))
* fix[devtools/useModalDismissSignal]: use getRootNode for shadow root
case support ([hoxyq](https://github.com/hoxyq) in
[#28145](#28145))
* fix: define IS_ACT_ENVIRONMENT global for tests with concurrent mode
and synchronous act ([hoxyq](https://github.com/hoxyq) in
[#28296](#28296))
* chore: gate legacy apis for react-devtools-shell
([hoxyq](https://github.com/hoxyq) in
[#28273](#28273))
* DevTools: Add support for use(Context)
([eps1lon](https://github.com/eps1lon) in
[#28233](#28233))
* Remove __self and __source location from elements
([sebmarkbage](https://github.com/sebmarkbage) in
[#28265](#28265))
* chore: use versioned render in inspectedElement test
([hoxyq](https://github.com/hoxyq) in
[#28246](#28246))
* chore: use versioned render in TimelineProfiler test and gate some for
legacy rendering ([hoxyq](https://github.com/hoxyq) in
[#28218](#28218))
* [Tests] Reset modules by default
([rickhanlonii](https://github.com/rickhanlonii) in
[#28254](#28254))
* chore: use versioned render in preprocessData test and gate some for …
([hoxyq](https://github.com/hoxyq) in
[#28219](#28219))
* chore: use versioned render in storeStressSync test and gate them for
legacy rendering ([hoxyq](https://github.com/hoxyq) in
[#28216](#28216))
* Patch devtools before running useMemo function in strict mode
([gsathya](https://github.com/gsathya) in
[#28249](#28249))
* chore: use versioned render in storeComponentFilters test
([hoxyq](https://github.com/hoxyq) in
[#28241](#28241))
* chore: use versioned render in profilerContext test
([hoxyq](https://github.com/hoxyq) in
[#28243](#28243))
* chore: use versioned render in profilingCommitTreeBuilder test and
gate some for legacy rendering ([hoxyq](https://github.com/hoxyq) in
[#28236](#28236))
* chore: use versioned render in profilingHostRoot test and gate some
for legacy rendering ([hoxyq](https://github.com/hoxyq) in
[#28237](#28237))
* chore: use versioned render in profilingCache test
([hoxyq](https://github.com/hoxyq) in
[#28242](#28242))
* chore: use versioned render in ownersListContext test
([hoxyq](https://github.com/hoxyq) in
[#28240](#28240))
* chore: use versioned render in editing test
([hoxyq](https://github.com/hoxyq) in
[#28239](#28239))
* chore: use versioned render in treeContext test
([hoxyq](https://github.com/hoxyq) in
[#28245](#28245))
* chore: use versioned render in store test
([hoxyq](https://github.com/hoxyq) in
[#28244](#28244))
* chore: use versioned render in profilerStore test
([hoxyq](https://github.com/hoxyq) in
[#28238](#28238))
* chore: use versioned render in profilingCharts test
([hoxyq](https://github.com/hoxyq) in
[#28235](#28235))
* chore: use versioned render in profilerChangeDescriptions test
([hoxyq](https://github.com/hoxyq) in
[#28221](#28221))
* chore: use versioned render in storeOwners test
([hoxyq](https://github.com/hoxyq) in
[#28215](#28215))
* chore: use versioned render in componentStacks test
([hoxyq](https://github.com/hoxyq) in
[#28214](#28214))
* chore: use versioned render in console test
([hoxyq](https://github.com/hoxyq) in
[#28213](#28213))
* chore: use versioned render in useEditableValue test
([hoxyq](https://github.com/hoxyq) in
[#28212](#28212))
* chore: use versioned render in FastRefreshDevToolsIntegration test
([hoxyq](https://github.com/hoxyq) in
[#28211](#28211))
* chore: add versioned render implementation for DevTools tests
([hoxyq](https://github.com/hoxyq) in
[#28210](#28210))
* chore: add single versioned implementation of act for DevTools tests
([hoxyq](https://github.com/hoxyq) in
[#28186](#28186))
* DevTools: Add support for useFormState
([eps1lon](https://github.com/eps1lon) in
[#28232](#28232))
* DevTools: Add support for useOptimistic Hook
([eps1lon](https://github.com/eps1lon) in
[#27982](#27982))
* Add stable React.act export ([acdlite](https://github.com/acdlite) in
[#28160](#28160))
* [flow] upgrade to 0.225.1 ([kassens](https://github.com/kassens) in
[#27871](#27871))
* fix[devtools/e2e]: add fallback for act in integration tests
([hoxyq](https://github.com/hoxyq) in
[#27842](#27842))
* Add stable concurrent option to react-test-renderer
([jackpope](https://github.com/jackpope) in
[#27804](#27804))
* Update act references in tests ([gnoff](https://github.com/gnoff) in
[#27805](#27805))
* Flow: make more objects exact ([kassens](https://github.com/kassens)
in [#27790](#27790))
huozhi added a commit to vercel/next.js that referenced this pull request Feb 23, 2024
@huozhi
Upgrade vendored react (#62326)
e5d604f
### React upstream changes

- react/react#28333
- react/react#28334
- react/react#28378
- react/react#28377
- react/react#28376
- react/react#28338
- react/react#28331
- react/react#28336
- react/react#28320
- react/react#28317
- react/react#28375
- react/react#28367
- react/react#28380
- react/react#28368
- react/react#28343
- react/react#28355
- react/react#28374
- react/react#28362
- react/react#28344
- react/react#28339
- react/react#28353
- react/react#28346
- react/react#25790
- react/react#28352
- react/react#28326
- react/react#27688
- react/react#28329
- react/react#28332
- react/react#28340
- react/react#28327
- react/react#28325
- react/react#28324
- react/react#28309
- react/react#28310
- react/react#28307
- react/react#28306
- react/react#28315
- react/react#28318
- react/react#28226
- react/react#28308
- react/react#27563
- react/react#28297
- react/react#28286
- react/react#28284
- react/react#28275
- react/react#28145
- react/react#28301
- react/react#28224
- react/react#28152
- react/react#28296
- react/react#28294
- react/react#28279
- react/react#28273
- react/react#28269
- react/react#28376
- react/react#28338
- react/react#28331
- react/react#28336
- react/react#28320
- react/react#28317
- react/react#28375
- react/react#28367
- react/react#28380
- react/react#28368
- react/react#28343
- react/react#28355
- react/react#28374
- react/react#28362
- react/react#28344
- react/react#28339
- react/react#28353
- react/react#28346
- react/react#25790
- react/react#28352
- react/react#28326
- react/react#27688
- react/react#28329
- react/react#28332
- react/react#28340
- react/react#28327
- react/react#28325
- react/react#28324
- react/react#28309
- react/react#28310
- react/react#28307
- react/react#28306
- react/react#28315
- react/react#28318
- react/react#28226
- react/react#28308
- react/react#27563
- react/react#28297
- react/react#28286
- react/react#28284
- react/react#28275
- react/react#28145
- react/react#28301
- react/react#28224
- react/react#28152
- react/react#28296
- react/react#28294
- react/react#28279
- react/react#28273
- react/react#28269

Closes NEXT-2542


Disable ppr test for strict mode for now, @acdlite will check it and
we'll sync again
@gaearon gaearon mentioned this pull request Feb 25, 2024
Clean up the flag for renderable context #28437
Closed
@CodyJasonBennett CodyJasonBennett mentioned this pull request Mar 12, 2024
fix: support React19 enableRenderableContext pmndrs/its-fine#33
Merged
@ztanner ztanner mentioned this pull request Mar 19, 2024
(backport) Update React from 60a927d04 to 14898b6a9 vercel/next.js#63442
Closed
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@gaearon @AndyPengc12
Switch <Context> to mean <Context.Provider> (react#28226)
229d662
Previously, `<Context>` was equivalent to `<Context.Consumer>`. However,
since the introduction of Hooks, the `<Context.Consumer>` API is rarely
used. The goal here is to make the common case cleaner:

```js
const ThemeContext = createContext('light')

function App() {
  return (
    <ThemeContext value="dark">
      ...
    </ThemeContext>
  )
}

function Button() {
  const theme = use(ThemeContext)
  // ...
}
```

This is technically a breaking change, but we've been warning about
rendering `<Context>` directly for several years by now, so it's
unlikely much code in the wild depends on the old behavior. [Proof that
it warns today (check
console).](https://codesandbox.io/p/sandbox/peaceful-nobel-pdxtfl)

---

**The relevant commit is 5696782.** It
switches `createContext` implementation so that `Context.Provider ===
Context`.

The main assumption that changed is that a Provider's fiber type is now
the context itself (rather than an intermediate object). Whereas a
Consumer's fiber type is now always an intermediate object (rather than
it being sometimes the context itself and sometimes an intermediate
object).

My methodology was to start with the relevant symbols, work tags, and
types, and work my way backwards to all usages.

This might break tooling that depends on inspecting React's internal
fields. I've added DevTools support in the second commit. This didn't
need explicit versioning—the structure tells us enough.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
@hoxyq @AndyPengc12
React DevTools 5.0.0 -> 5.0.1 (react#28418)
58c3f5b
Full list of changes (not a public CHANGELOG):

* feature[REMOVED][devtools]: turn off / hide location based component
filters ([hoxyq](https://github.com/hoxyq) in
[react#28417](react#28417))
* Add useSyncExternalStore and useTransition to getPrimitiveStackCache
([jamesbvaughan](https://github.com/jamesbvaughan) in
[react#28399](react#28399))
* chore[devtools]: use react-window from npm and bump
react-virtualized-auto-sizer to ^1.0.23
([hoxyq](https://github.com/hoxyq) in
[react#28408](react#28408))
* Pass ref as normal prop ([acdlite](https://github.com/acdlite) in
[react#28348](react#28348))
* Combine createElement and JSX modules
([acdlite](https://github.com/acdlite) in
[react#28320](react#28320))
* [Debug Tools] Always use includeHooksSource option
([sebmarkbage](https://github.com/sebmarkbage) in
[react#28309](react#28309))
* Revert "[Tests] Reset modules by default"
([acdlite](https://github.com/acdlite) in
[react#28318](react#28318))
* Switch <Context> to mean <Context.Provider>
([gaearon](https://github.com/gaearon) in
[react#28226](react#28226))
* [Debug Tools] Introspect Promises in use()
([sebmarkbage](https://github.com/sebmarkbage) in
[react#28297](react#28297))
* fix[devtools/useModalDismissSignal]: use getRootNode for shadow root
case support ([hoxyq](https://github.com/hoxyq) in
[react#28145](react#28145))
* fix: define IS_ACT_ENVIRONMENT global for tests with concurrent mode
and synchronous act ([hoxyq](https://github.com/hoxyq) in
[react#28296](react#28296))
* chore: gate legacy apis for react-devtools-shell
([hoxyq](https://github.com/hoxyq) in
[react#28273](react#28273))
* DevTools: Add support for use(Context)
([eps1lon](https://github.com/eps1lon) in
[react#28233](react#28233))
* Remove __self and __source location from elements
([sebmarkbage](https://github.com/sebmarkbage) in
[react#28265](react#28265))
* chore: use versioned render in inspectedElement test
([hoxyq](https://github.com/hoxyq) in
[react#28246](react#28246))
* chore: use versioned render in TimelineProfiler test and gate some for
legacy rendering ([hoxyq](https://github.com/hoxyq) in
[react#28218](react#28218))
* [Tests] Reset modules by default
([rickhanlonii](https://github.com/rickhanlonii) in
[react#28254](react#28254))
* chore: use versioned render in preprocessData test and gate some for …
([hoxyq](https://github.com/hoxyq) in
[react#28219](react#28219))
* chore: use versioned render in storeStressSync test and gate them for
legacy rendering ([hoxyq](https://github.com/hoxyq) in
[react#28216](react#28216))
* Patch devtools before running useMemo function in strict mode
([gsathya](https://github.com/gsathya) in
[react#28249](react#28249))
* chore: use versioned render in storeComponentFilters test
([hoxyq](https://github.com/hoxyq) in
[react#28241](react#28241))
* chore: use versioned render in profilerContext test
([hoxyq](https://github.com/hoxyq) in
[react#28243](react#28243))
* chore: use versioned render in profilingCommitTreeBuilder test and
gate some for legacy rendering ([hoxyq](https://github.com/hoxyq) in
[react#28236](react#28236))
* chore: use versioned render in profilingHostRoot test and gate some
for legacy rendering ([hoxyq](https://github.com/hoxyq) in
[react#28237](react#28237))
* chore: use versioned render in profilingCache test
([hoxyq](https://github.com/hoxyq) in
[react#28242](react#28242))
* chore: use versioned render in ownersListContext test
([hoxyq](https://github.com/hoxyq) in
[react#28240](react#28240))
* chore: use versioned render in editing test
([hoxyq](https://github.com/hoxyq) in
[react#28239](react#28239))
* chore: use versioned render in treeContext test
([hoxyq](https://github.com/hoxyq) in
[react#28245](react#28245))
* chore: use versioned render in store test
([hoxyq](https://github.com/hoxyq) in
[react#28244](react#28244))
* chore: use versioned render in profilerStore test
([hoxyq](https://github.com/hoxyq) in
[react#28238](react#28238))
* chore: use versioned render in profilingCharts test
([hoxyq](https://github.com/hoxyq) in
[react#28235](react#28235))
* chore: use versioned render in profilerChangeDescriptions test
([hoxyq](https://github.com/hoxyq) in
[react#28221](react#28221))
* chore: use versioned render in storeOwners test
([hoxyq](https://github.com/hoxyq) in
[react#28215](react#28215))
* chore: use versioned render in componentStacks test
([hoxyq](https://github.com/hoxyq) in
[react#28214](react#28214))
* chore: use versioned render in console test
([hoxyq](https://github.com/hoxyq) in
[react#28213](react#28213))
* chore: use versioned render in useEditableValue test
([hoxyq](https://github.com/hoxyq) in
[react#28212](react#28212))
* chore: use versioned render in FastRefreshDevToolsIntegration test
([hoxyq](https://github.com/hoxyq) in
[react#28211](react#28211))
* chore: add versioned render implementation for DevTools tests
([hoxyq](https://github.com/hoxyq) in
[react#28210](react#28210))
* chore: add single versioned implementation of act for DevTools tests
([hoxyq](https://github.com/hoxyq) in
[react#28186](react#28186))
* DevTools: Add support for useFormState
([eps1lon](https://github.com/eps1lon) in
[react#28232](react#28232))
* DevTools: Add support for useOptimistic Hook
([eps1lon](https://github.com/eps1lon) in
[react#27982](react#27982))
* Add stable React.act export ([acdlite](https://github.com/acdlite) in
[react#28160](react#28160))
* [flow] upgrade to 0.225.1 ([kassens](https://github.com/kassens) in
[react#27871](react#27871))
* fix[devtools/e2e]: add fallback for act in integration tests
([hoxyq](https://github.com/hoxyq) in
[react#27842](react#27842))
* Add stable concurrent option to react-test-renderer
([jackpope](https://github.com/jackpope) in
[react#27804](react#27804))
* Update act references in tests ([gnoff](https://github.com/gnoff) in
[react#27805](react#27805))
* Flow: make more objects exact ([kassens](https://github.com/kassens)
in [react#27790](react#27790))
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
@rickhanlonii
Switch <Context> to mean <Context.Provider> (#28226)
e7e86e5
Previously, `<Context>` was equivalent to `<Context.Consumer>`. However,
since the introduction of Hooks, the `<Context.Consumer>` API is rarely
used. The goal here is to make the common case cleaner:

```js
const ThemeContext = createContext('light')

function App() {
  return (
    <ThemeContext value="dark">
      ...
    </ThemeContext>
  )
}

function Button() {
  const theme = use(ThemeContext)
  // ...
}
```

This is technically a breaking change, but we've been warning about
rendering `<Context>` directly for several years by now, so it's
unlikely much code in the wild depends on the old behavior. [Proof that
it warns today (check
console).](https://codesandbox.io/p/sandbox/peaceful-nobel-pdxtfl)

---

**The relevant commit is 5696782.** It
switches `createContext` implementation so that `Context.Provider ===
Context`.

The main assumption that changed is that a Provider's fiber type is now
the context itself (rather than an intermediate object). Whereas a
Consumer's fiber type is now always an intermediate object (rather than
it being sometimes the context itself and sometimes an intermediate
object).

My methodology was to start with the relevant symbols, work tags, and
types, and work my way backwards to all usages.

This might break tooling that depends on inspecting React's internal
fields. I've added DevTools support in the second commit. This didn't
need explicit versioning—the structure tells us enough.

DiffTrain build for commit 14fd963.
@MyPrototypeWhat MyPrototypeWhat mentioned this pull request May 31, 2024
React@v19源码---useContext MyPrototypeWhat/take-down-react#7
Open
FMota0 added a commit to plasmicapp/react-ssr-prepass that referenced this pull request Nov 26, 2024
@FMota0
fix(react-v19): Properly support react v19
143477d
Make prepass backwards compatible with react v19, it was necessary to handle with the following changes in React:
- react/react#28789
- react/react#28813
- react/react#28226
@FMota0 FMota0 mentioned this pull request Nov 26, 2024
fix(react-v19): Properly support react v19 plasmicapp/react-ssr-prepass#3
Merged
FMota0 added a commit to plasmicapp/react-ssr-prepass that referenced this pull request Nov 27, 2024
@FMota0
fix(react-v19): Properly support react v19
35495d6
Make prepass backwards compatible with react v19, it was necessary to handle with the following changes in React:
- react/react#28789
- react/react#28813
- react/react#28226
FMota0 added a commit to plasmicapp/react-ssr-prepass that referenced this pull request Nov 27, 2024
@FMota0
fix(react-v19): Properly support react v19
8cc4a6f
Make prepass backwards compatible with react v19, it was necessary to handle with the following changes in React:
- react/react#28789
- react/react#28813
- react/react#28226
Akshato07 pushed a commit to Akshato07/-Luffy that referenced this pull request Feb 20, 2025
@hoxyq
React DevTools 5.0.0 -> 5.0.1 (#28418)
9fac9d7
Full list of changes (not a public CHANGELOG):

* feature[REMOVED][devtools]: turn off / hide location based component
filters ([hoxyq](https://github.com/hoxyq) in
[#28417](react/react#28417))
* Add useSyncExternalStore and useTransition to getPrimitiveStackCache
([jamesbvaughan](https://github.com/jamesbvaughan) in
[#28399](react/react#28399))
* chore[devtools]: use react-window from npm and bump
react-virtualized-auto-sizer to ^1.0.23
([hoxyq](https://github.com/hoxyq) in
[#28408](react/react#28408))
* Pass ref as normal prop ([acdlite](https://github.com/acdlite) in
[#28348](react/react#28348))
* Combine createElement and JSX modules
([acdlite](https://github.com/acdlite) in
[#28320](react/react#28320))
* [Debug Tools] Always use includeHooksSource option
([sebmarkbage](https://github.com/sebmarkbage) in
[#28309](react/react#28309))
* Revert "[Tests] Reset modules by default"
([acdlite](https://github.com/acdlite) in
[#28318](react/react#28318))
* Switch <Context> to mean <Context.Provider>
([gaearon](https://github.com/gaearon) in
[#28226](react/react#28226))
* [Debug Tools] Introspect Promises in use()
([sebmarkbage](https://github.com/sebmarkbage) in
[#28297](react/react#28297))
* fix[devtools/useModalDismissSignal]: use getRootNode for shadow root
case support ([hoxyq](https://github.com/hoxyq) in
[#28145](react/react#28145))
* fix: define IS_ACT_ENVIRONMENT global for tests with concurrent mode
and synchronous act ([hoxyq](https://github.com/hoxyq) in
[#28296](react/react#28296))
* chore: gate legacy apis for react-devtools-shell
([hoxyq](https://github.com/hoxyq) in
[#28273](react/react#28273))
* DevTools: Add support for use(Context)
([eps1lon](https://github.com/eps1lon) in
[#28233](react/react#28233))
* Remove __self and __source location from elements
([sebmarkbage](https://github.com/sebmarkbage) in
[#28265](react/react#28265))
* chore: use versioned render in inspectedElement test
([hoxyq](https://github.com/hoxyq) in
[#28246](react/react#28246))
* chore: use versioned render in TimelineProfiler test and gate some for
legacy rendering ([hoxyq](https://github.com/hoxyq) in
[#28218](react/react#28218))
* [Tests] Reset modules by default
([rickhanlonii](https://github.com/rickhanlonii) in
[#28254](react/react#28254))
* chore: use versioned render in preprocessData test and gate some for …
([hoxyq](https://github.com/hoxyq) in
[#28219](react/react#28219))
* chore: use versioned render in storeStressSync test and gate them for
legacy rendering ([hoxyq](https://github.com/hoxyq) in
[#28216](react/react#28216))
* Patch devtools before running useMemo function in strict mode
([gsathya](https://github.com/gsathya) in
[#28249](react/react#28249))
* chore: use versioned render in storeComponentFilters test
([hoxyq](https://github.com/hoxyq) in
[#28241](react/react#28241))
* chore: use versioned render in profilerContext test
([hoxyq](https://github.com/hoxyq) in
[#28243](react/react#28243))
* chore: use versioned render in profilingCommitTreeBuilder test and
gate some for legacy rendering ([hoxyq](https://github.com/hoxyq) in
[#28236](react/react#28236))
* chore: use versioned render in profilingHostRoot test and gate some
for legacy rendering ([hoxyq](https://github.com/hoxyq) in
[#28237](react/react#28237))
* chore: use versioned render in profilingCache test
([hoxyq](https://github.com/hoxyq) in
[#28242](react/react#28242))
* chore: use versioned render in ownersListContext test
([hoxyq](https://github.com/hoxyq) in
[#28240](react/react#28240))
* chore: use versioned render in editing test
([hoxyq](https://github.com/hoxyq) in
[#28239](react/react#28239))
* chore: use versioned render in treeContext test
([hoxyq](https://github.com/hoxyq) in
[#28245](react/react#28245))
* chore: use versioned render in store test
([hoxyq](https://github.com/hoxyq) in
[#28244](react/react#28244))
* chore: use versioned render in profilerStore test
([hoxyq](https://github.com/hoxyq) in
[#28238](react/react#28238))
* chore: use versioned render in profilingCharts test
([hoxyq](https://github.com/hoxyq) in
[#28235](react/react#28235))
* chore: use versioned render in profilerChangeDescriptions test
([hoxyq](https://github.com/hoxyq) in
[#28221](react/react#28221))
* chore: use versioned render in storeOwners test
([hoxyq](https://github.com/hoxyq) in
[#28215](react/react#28215))
* chore: use versioned render in componentStacks test
([hoxyq](https://github.com/hoxyq) in
[#28214](react/react#28214))
* chore: use versioned render in console test
([hoxyq](https://github.com/hoxyq) in
[#28213](react/react#28213))
* chore: use versioned render in useEditableValue test
([hoxyq](https://github.com/hoxyq) in
[#28212](react/react#28212))
* chore: use versioned render in FastRefreshDevToolsIntegration test
([hoxyq](https://github.com/hoxyq) in
[#28211](react/react#28211))
* chore: add versioned render implementation for DevTools tests
([hoxyq](https://github.com/hoxyq) in
[#28210](react/react#28210))
* chore: add single versioned implementation of act for DevTools tests
([hoxyq](https://github.com/hoxyq) in
[#28186](react/react#28186))
* DevTools: Add support for useFormState
([eps1lon](https://github.com/eps1lon) in
[#28232](react/react#28232))
* DevTools: Add support for useOptimistic Hook
([eps1lon](https://github.com/eps1lon) in
[#27982](react/react#27982))
* Add stable React.act export ([acdlite](https://github.com/acdlite) in
[#28160](react/react#28160))
* [flow] upgrade to 0.225.1 ([kassens](https://github.com/kassens) in
[#27871](react/react#27871))
* fix[devtools/e2e]: add fallback for act in integration tests
([hoxyq](https://github.com/hoxyq) in
[#27842](react/react#27842))
* Add stable concurrent option to react-test-renderer
([jackpope](https://github.com/jackpope) in
[#27804](react/react#27804))
* Update act references in tests ([gnoff](https://github.com/gnoff) in
[#27805](react/react#27805))
* Flow: make more objects exact ([kassens](https://github.com/kassens)
in [#27790](react/react#27790))

DiffTrain build for commit react/react@288cf74.
henriettelienrebnor pushed a commit to equinor/Dexpi2Imf that referenced this pull request Apr 23, 2025
@mmsge @snyk-bot
[Snyk] Upgrade react from 19.0.0 to 19.1.0 (#122)
bab4cbe
![snyk-top-banner](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)


<h3>Snyk has created this PR to upgrade react from 19.0.0 to
19.1.0.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>


- The recommended version is **78 versions** ahead of your current
version.

- The recommended version was released **22 days ago**.



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>react</b></summary>
    <ul>
      <li>
<b>19.1.0</b> - <a
href="https://redirect.github.com/facebook/react/releases/tag/v19.1.0">2025-03-28</a></br><h3>Owner
Stack</h3>
<p>An Owner Stack is a string representing the components that are
directly responsible for rendering a particular component. You can log
Owner Stacks when debugging or use Owner Stacks to enhance error
overlays or other development tools. Owner Stacks are only available in
development builds. Component Stacks in production are unchanged.</p>
<ul>
<li>An Owner Stack is a development-only stack trace that helps identify
which components are responsible for rendering a particular component.
An Owner Stack is distinct from a Component Stacks, which shows the
hierarchy of components leading to an error.</li>
<li>The <a href="https://react.dev/reference/react/captureOwnerStack"
rel="nofollow">captureOwnerStack API</a> is only available in
development mode and returns a Owner Stack, if available. The API can be
used to enhance error overlays or log component relationships when
debugging. <a
href="https://redirect.github.com/facebook/react/pull/29923"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/29923/hovercard">#29923</a>, <a
href="https://redirect.github.com/facebook/react/pull/32353"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32353/hovercard">#32353</a>, <a
href="https://redirect.github.com/facebook/react/pull/30306"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/30306/hovercard">#30306</a>,<br>
<a href="https://redirect.github.com/facebook/react/pull/32538"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32538/hovercard">#32538</a>, <a
href="https://redirect.github.com/facebook/react/pull/32529"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32529/hovercard">#32529</a>, <a
href="https://redirect.github.com/facebook/react/pull/32538"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32538/hovercard">#32538</a></li>
</ul>
<h3>React</h3>
<ul>
<li>Enhanced support for Suspense boundaries to be used anywhere,
including the client, server, and during hydration. <a
href="https://redirect.github.com/facebook/react/pull/32069"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32069/hovercard">#32069</a>, <a
href="https://redirect.github.com/facebook/react/pull/32163"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32163/hovercard">#32163</a>, <a
href="https://redirect.github.com/facebook/react/pull/32224"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32224/hovercard">#32224</a>, <a
href="https://redirect.github.com/facebook/react/pull/32252"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32252/hovercard">#32252</a></li>
<li>Reduced unnecessary client rendering through improved hydration
scheduling <a
href="https://redirect.github.com/facebook/react/pull/31751"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31751/hovercard">#31751</a></li>
<li>Increased priority of client rendered Suspense boundaries <a
href="https://redirect.github.com/facebook/react/pull/31776"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31776/hovercard">#31776</a></li>
<li>Fixed frozen fallback states by rendering unfinished Suspense
boundaries on the client. <a
href="https://redirect.github.com/facebook/react/pull/31620"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31620/hovercard">#31620</a></li>
<li>Reduced garbage collection pressure by improving Suspense boundary
retries. <a href="https://redirect.github.com/facebook/react/pull/31667"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31667/hovercard">#31667</a></li>
<li>Fixed erroneous “Waiting for Paint” log when the passive effect
phase was not delayed <a
href="https://redirect.github.com/facebook/react/pull/31526"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31526/hovercard">#31526</a></li>
<li>Fixed a regression causing key warnings for flattened positional
children in development mode. <a
href="https://redirect.github.com/facebook/react/pull/32117"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32117/hovercard">#32117</a></li>
<li>Updated <code>useId</code> to use valid CSS selectors, changing
format from <code>:r123:</code> to <code>«r123»</code>. <a
href="https://redirect.github.com/facebook/react/pull/32001"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32001/hovercard">#32001</a></li>
<li>Added a dev-only warning for null/undefined created in useEffect,
useInsertionEffect, and useLayoutEffect. <a
href="https://redirect.github.com/facebook/react/pull/32355"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32355/hovercard">#32355</a></li>
<li>Fixed a bug where dev-only methods were exported in production
builds. React.act is no longer available in production builds. <a
href="https://redirect.github.com/facebook/react/pull/32200"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32200/hovercard">#32200</a></li>
<li>Improved consistency across prod and dev to improve compatibility
with Google Closure Complier and bindings <a
href="https://redirect.github.com/facebook/react/pull/31808"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31808/hovercard">#31808</a></li>
<li>Improve passive effect scheduling for consistent task yielding. <a
href="https://redirect.github.com/facebook/react/pull/31785"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31785/hovercard">#31785</a></li>
<li>Fixed asserts in React Native when
passChildrenWhenCloningPersistedNodes is enabled for OffscreenComponent
rendering. <a
href="https://redirect.github.com/facebook/react/pull/32528"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32528/hovercard">#32528</a></li>
<li>Fixed component name resolution for Portal <a
href="https://redirect.github.com/facebook/react/pull/32640"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32640/hovercard">#32640</a></li>
<li>Added support for beforetoggle and toggle events on the dialog
element. <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="2882132160" data-permission-text="Title is private"
data-url="https://github.com/facebook/react/issues/32479"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32479/hovercard"
href="https://redirect.github.com/facebook/react/pull/32479">#32479</a>
<a href="https://redirect.github.com/facebook/react/pull/32479"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32479/hovercard">#32479</a></li>
</ul>
<h3>React DOM</h3>
<ul>
<li>Fixed double warning when the <code>href</code> attribute is an
empty string <a
href="https://redirect.github.com/facebook/react/pull/31783"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31783/hovercard">#31783</a></li>
<li>Fixed an edge case where <code>getHoistableRoot()</code> didn’t work
properly when the container was a Document <a
href="https://redirect.github.com/facebook/react/pull/32321"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32321/hovercard">#32321</a></li>
<li>Removed support for using HTML comments (e.g. <code>&lt;!--
--&gt;</code>) as a DOM container. <a
href="https://redirect.github.com/facebook/react/pull/32250"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32250/hovercard">#32250</a></li>
<li>Added support for <code>&lt;script&gt;</code> and
<code>&lt;template&gt;</code> tags to be nested within
<code>&lt;select&gt;</code> tags. <a
href="https://redirect.github.com/facebook/react/pull/31837"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31837/hovercard">#31837</a></li>
<li>Fixed responsive images to be preloaded as HTML instead of headers
<a href="https://redirect.github.com/facebook/react/pull/32445"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32445/hovercard">#32445</a></li>
</ul>
<h3>use-sync-external-store</h3>
<ul>
<li>Added <code>exports</code> field to <code>package.json</code> for
<code>use-sync-external-store</code> to support various entrypoints. <a
href="https://redirect.github.com/facebook/react/pull/25231"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/25231/hovercard">#25231</a></li>
</ul>
<h3>React Server Components</h3>
<ul>
<li>Added <code>unstable_prerender</code>, a new experimental API for
prerendering React Server Components on the server <a
href="https://redirect.github.com/facebook/react/pull/31724"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31724/hovercard">#31724</a></li>
<li>Fixed an issue where streams would hang when receiving new chunks
after a global error <a
href="https://redirect.github.com/facebook/react/pull/31840"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31840/hovercard">#31840</a>, <a
href="https://redirect.github.com/facebook/react/pull/31851"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31851/hovercard">#31851</a></li>
<li>Fixed an issue where pending chunks were counted twice. <a
href="https://redirect.github.com/facebook/react/pull/31833"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31833/hovercard">#31833</a></li>
<li>Added support for streaming in edge environments <a
href="https://redirect.github.com/facebook/react/pull/31852"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31852/hovercard">#31852</a></li>
<li>Added support for sending custom error names from a server so that
they are available in the client for console replaying. <a
href="https://redirect.github.com/facebook/react/pull/32116"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32116/hovercard">#32116</a></li>
<li>Updated the server component wire format to remove IDs for hints and
console.log because they have no return value <a
href="https://redirect.github.com/facebook/react/pull/31671"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31671/hovercard">#31671</a></li>
<li>Exposed <code>registerServerReference</code> in client builds to
handle server references in different environments. <a
href="https://redirect.github.com/facebook/react/pull/32534"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32534/hovercard">#32534</a></li>
<li>Added react-server-dom-parcel package which integrates Server
Components with the <a href="https://parceljs.org/"
rel="nofollow">Parcel bundler</a> <a
href="https://redirect.github.com/facebook/react/pull/31725"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31725/hovercard">#31725</a>, <a
href="https://redirect.github.com/facebook/react/pull/32132"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32132/hovercard">#32132</a>, <a
href="https://redirect.github.com/facebook/react/pull/31799"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31799/hovercard">#31799</a>, <a
href="https://redirect.github.com/facebook/react/pull/32294"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/32294/hovercard">#32294</a>, <a
href="https://redirect.github.com/facebook/react/pull/31741"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/31741/hovercard">#31741</a></li>
</ul>
      </li>
      <li>
        <b>19.1.0-canary-ff628334-20250205</b> - 2025-02-06
      </li>
      <li>
        <b>19.1.0-canary-fcb4e0f1-20250219</b> - 2025-02-20
      </li>
      <li>
        <b>19.1.0-canary-fc8a898d-20241226</b> - 2024-12-27
      </li>
      <li>
        <b>19.1.0-canary-fbcda19a-20250317</b> - 2025-03-17
      </li>
      <li>
        <b>19.1.0-canary-f9d78089-20250306</b> - 2025-03-07
      </li>
      <li>
        <b>19.1.0-canary-f83903bf-20250212</b> - 2025-02-12
      </li>
      <li>
        <b>19.1.0-canary-f457d0b4-20250313</b> - 2025-03-13
      </li>
      <li>
        <b>19.1.0-canary-f0edf41e-20250115</b> - 2025-01-14
      </li>
      <li>
        <b>19.1.0-canary-ef979d47-20241218</b> - 2024-12-18
      </li>
      <li>
        <b>19.1.0-canary-ef4bc8b4-20250328</b> - 2025-03-28
      </li>
      <li>
        <b>19.1.0-canary-ebc22ef7-20250225</b> - 2025-02-26
      </li>
      <li>
        <b>19.1.0-canary-e670e72f-20250214</b> - 2025-02-14
      </li>
      <li>
        <b>19.1.0-canary-e1e74071-20250321</b> - 2025-03-21
      </li>
      <li>
        <b>19.1.0-canary-e06c72fc-20241215</b> - 2024-12-16
      </li>
      <li>
        <b>19.1.0-canary-e03ac20f-20250305</b> - 2025-03-05
      </li>
      <li>
        <b>19.1.0-canary-de82912e-20241220</b> - 2024-12-20
      </li>
      <li>
        <b>19.1.0-canary-de1eaa26-20250124</b> - 2025-01-24
      </li>
      <li>
        <b>19.1.0-canary-db7dfe05-20250319</b> - 2025-03-19
      </li>
      <li>
        <b>19.1.0-canary-d85cf3e5-20250205</b> - 2025-02-05
      </li>
      <li>
        <b>19.1.0-canary-d55cc79b-20250228</b> - 2025-02-28
      </li>
      <li>
        <b>19.1.0-canary-d46b04a2-20250117</b> - 2025-01-17
      </li>
      <li>
        <b>19.1.0-canary-d4287258-20241217</b> - 2024-12-17
      </li>
      <li>
        <b>19.1.0-canary-d331ba04-20250307</b> - 2025-03-10
      </li>
      <li>
        <b>19.1.0-canary-cd90a4d8-20250210</b> - 2025-02-11
      </li>
      <li>
        <b>19.1.0-canary-cbbe8666-20250213</b> - 2025-02-13
      </li>
      <li>
        <b>19.1.0-canary-cabd8a0e-20250113</b> - 2025-01-13
      </li>
      <li>
        <b>19.1.0-canary-c69a5fc5-20250318</b> - 2025-03-18
      </li>
      <li>
        <b>19.1.0-canary-c492f975-20250128</b> - 2025-01-29
      </li>
      <li>
        <b>19.1.0-canary-c01b8058-20241229</b> - 2024-12-30
      </li>
      <li>
        <b>19.1.0-canary-bb9a24d9-20250130</b> - 2025-01-30
      </li>
      <li>
        <b>19.1.0-canary-b3a95caf-20250113</b> - 2025-01-14
      </li>
      <li>
        <b>19.1.0-canary-b158439a-20250115</b> - 2025-01-15
      </li>
      <li>
        <b>19.1.0-canary-ae9017ce-20250122</b> - 2025-01-23
      </li>
      <li>
        <b>19.1.0-canary-a84862db-20250218</b> - 2025-02-19
      </li>
      <li>
        <b>19.1.0-canary-a4f9bd58-20250319</b> - 2025-03-20
      </li>
      <li>
        <b>19.1.0-canary-a4b2d0d5-20250203</b> - 2025-02-03
      </li>
      <li>
        <b>19.1.0-canary-9ff42a87-20250130</b> - 2025-01-31
      </li>
      <li>
        <b>19.1.0-canary-9eabb373-20250124</b> - 2025-01-27
      </li>
      <li>
        <b>19.1.0-canary-9b62ee71-20250122</b> - 2025-01-22
      </li>
      <li>
        <b>19.1.0-canary-97d79495-20241223</b> - 2024-12-24
      </li>
      <li>
        <b>19.1.0-canary-9463d51e-20241219</b> - 2024-12-19
      </li>
      <li>
        <b>19.1.0-canary-93b58361-20250209</b> - 2025-02-10
      </li>
      <li>
        <b>19.1.0-canary-8a7b487e-20250218</b> - 2025-02-18
      </li>
      <li>
        <b>19.1.0-canary-8759c5c8-20250207</b> - 2025-02-07
      </li>
      <li>
        <b>19.1.0-canary-7eb8234f-20241218</b> - 2024-12-18
      </li>
      <li>
        <b>19.1.0-canary-7b402084-20250107</b> - 2025-01-07
      </li>
      <li>
        <b>19.1.0-canary-74ea0c73-20250109</b> - 2025-01-09
      </li>
      <li>
        <b>19.1.0-canary-740a4f7a-20250325</b> - 2025-03-25
      </li>
      <li>
        <b>19.1.0-canary-7130d0c6-20241212</b> - 2024-12-12
      </li>
      <li>
        <b>19.1.0-canary-6aa8254b-20250312</b> - 2025-03-12
      </li>
      <li>
        <b>19.1.0-canary-694d3e1a-20241231</b> - 2025-01-01
      </li>
      <li>
        <b>19.1.0-canary-6907aa2a-20241220</b> - 2024-12-23
      </li>
      <li>
        <b>19.1.0-canary-662957cc-20250221</b> - 2025-02-21
      </li>
      <li>
        <b>19.1.0-canary-62208bee-20250102</b> - 2025-01-02
      </li>
      <li>
        <b>19.1.0-canary-5b51a2b9-20250116</b> - 2025-01-16
      </li>
      <li>
        <b>19.1.0-canary-540efebc-20250112</b> - 2025-01-12
      </li>
      <li>
        <b>19.1.0-canary-5398b711-20250314</b> - 2025-03-14
      </li>
      <li>
        <b>19.1.0-canary-518d06d2-20241219</b> - 2024-12-19
      </li>
      <li>
        <b>19.1.0-canary-4dff0e62-20241213</b> - 2024-12-13
      </li>
      <li>
        <b>19.1.0-canary-4632e36a-20250216</b> - 2025-02-17
      </li>
      <li>
        <b>19.1.0-canary-443b7ff2-20250303</b> - 2025-03-04
      </li>
      <li>
        <b>19.1.0-canary-4280563b-20250326</b> - 2025-03-27
      </li>
      <li>
        <b>19.1.0-canary-42687267-20250108</b> - 2025-01-08
      </li>
      <li>
        <b>19.1.0-canary-3ce77d55-20250106</b> - 2025-01-06
      </li>
      <li>
        <b>19.1.0-canary-3b009b4c-20250102</b> - 2025-01-03
      </li>
      <li>
        <b>19.1.0-canary-37906d4d-20250127</b> - 2025-01-28
      </li>
      <li>
        <b>19.1.0-canary-32b0cad8-20250213</b> - 2025-02-13
      </li>
      <li>
        <b>19.1.0-canary-313332d1-20250326</b> - 2025-03-26
      </li>
      <li>
        <b>19.1.0-canary-2980f277-20250301</b> - 2025-03-03
      </li>
      <li>
        <b>19.1.0-canary-25677265-20250224</b> - 2025-02-24
      </li>
      <li>
        <b>19.1.0-canary-22e39ea7-20250225</b> - 2025-02-25
      </li>
      <li>
        <b>19.1.0-canary-18eaf51b-20250118</b> - 2025-01-20
      </li>
      <li>
        <b>19.1.0-canary-130095f7-20241212</b> - 2024-12-12
      </li>
      <li>
        <b>19.1.0-canary-0ca3deeb-20250311</b> - 2025-03-11
      </li>
      <li>
        <b>19.1.0-canary-0a82580b-20250203</b> - 2025-02-04
      </li>
      <li>
        <b>19.1.0-canary-056073de-20250109</b> - 2025-01-10
      </li>
      <li>
        <b>19.1.0-canary-029e8bd6-20250306</b> - 2025-03-06
      </li>
      <li>
<b>19.0.0</b> - <a
href="https://redirect.github.com/facebook/react/releases/tag/v19.0.0">2024-12-05</a></br><p>Below
is a list of all new features, APIs, deprecations, and breaking changes.
Read <a href="https://react.dev/blog/2024/04/25/react-19"
rel="nofollow">React 19 release post</a> and <a
href="https://react.dev/blog/2024/04/25/react-19-upgrade-guide"
rel="nofollow">React 19 upgrade guide</a> for more information.</p>
<blockquote>
<p>Note: To help make the upgrade to React 19 easier, we’ve published a
[email protected] release that is identical to 18.2 but adds warnings for
deprecated APIs and other changes that are needed for React 19. We
recommend upgrading to React 18.3.1 first to help identify any issues
before upgrading to React 19.</p>
</blockquote>
<h2>New Features</h2>
<h3>React</h3>
<ul>
<li>Actions: <code>startTransition</code> can now accept async
functions. Functions passed to <code>startTransition</code> are called
“Actions”. A given Transition can include one or more Actions which
update state in the background and update the UI with one commit. In
addition to updating state, Actions can now perform side effects
including async requests, and the Action will wait for the work to
finish before finishing the Transition. This feature allows Transitions
to include side effects like <code>fetch()</code> in the pending state,
and provides support for error handling, and optimistic updates.</li>
<li><code>useActionState</code>: is a new hook to order Actions inside
of a Transition with access to the state of the action, and the pending
state. It accepts a reducer that can call Actions, and the initial state
used for first render. It also accepts an optional string that is used
if the action is passed to a form <code>action</code> prop to support
progressive enhancement in forms.</li>
<li><code>useOptimistic</code>: is a new hook to update state while a
Transition is in progress. It returns the state, and a set function that
can be called inside a transition to “optimistically” update the state
to expected final value immediately while the Transition completes in
the background. When the transition finishes, the state is updated to
the new value.</li>
<li><code>use</code>: is a new API that allows reading resources in
render. In React 19, <code>use</code> accepts a promise or Context. If
provided a promise, <code>use</code> will suspend until a value is
resolved. <code>use</code> can only be used in render but can be called
conditionally.</li>
<li><code>ref</code> as a prop: Refs can now be used as props, removing
the need for <code>forwardRef</code>.</li>
<li><strong>Suspense sibling pre-warming</strong>: When a component
suspends, React will immediately commit the fallback of the nearest
Suspense boundary, without waiting for the entire sibling tree to
render. After the fallback commits, React will schedule another render
for the suspended siblings to “pre-warm” lazy requests.</li>
</ul>
<h3>React DOM Client</h3>
<ul>
<li><code>&lt;form&gt; action</code> prop: Form Actions allow you to
manage forms automatically and integrate with
<code>useFormStatus</code>. When a <code>&lt;form&gt; action</code>
succeeds, React will automatically reset the form for uncontrolled
components. The form can be reset manually with the new
<code>requestFormReset</code> API.</li>
<li><code>&lt;button&gt; and &lt;input&gt; formAction</code> prop:
Actions can be passed to the <code>formAction</code> prop to configure
form submission behavior. This allows using different Actions depending
on the input.</li>
<li><code>useFormStatus</code>: is a new hook that provides the status
of the parent <code>&lt;form&gt; action</code>, as if the form was a
Context provider. The hook returns the values: <code>pending</code>,
<code>data</code>, <code>method</code>, and <code>action</code>.</li>
<li>Support for Document Metadata: We’ve added support for rendering
document metadata tags in components natively. React will automatically
hoist them into the <code>&lt;head&gt;</code> section of the
document.</li>
<li>Support for Stylesheets: React 19 will ensure stylesheets are
inserted into the <code>&lt;head&gt;</code> on the client before
revealing the content of a Suspense boundary that depends on that
stylesheet.</li>
<li>Support for async scripts: Async scripts can be rendered anywhere in
the component tree and React will handle ordering and
deduplication.</li>
<li>Support for preloading resources: React 19 ships with
<code>preinit</code>, <code>preload</code>, <code>prefetchDNS</code>,
and <code>preconnect</code> APIs to optimize initial page loads by
moving discovery of additional resources like fonts out of stylesheet
loading. They can also be used to prefetch resources used by an
anticipated navigation.</li>
</ul>
<h3>React DOM Server</h3>
<ul>
<li>Added <code>prerender</code> and <code>prerenderToNodeStream</code>
APIs for static site generation. They are designed to work with
streaming environments like Node.js Streams and Web Streams. Unlike
<code>renderToString</code>, they wait for data to load for HTML
generation.</li>
</ul>
<h3>React Server Components</h3>
<ul>
<li>RSC features such as directives, server components, and server
functions are now stable. This means libraries that ship with Server
Components can now target React 19 as a peer dependency with a
react-server export condition for use in frameworks that support the
Full-stack React Architecture. The underlying APIs used to implement a
React Server Components bundler or framework do not follow semver and
may break between minors in React 19.x. See <a
href="https://19.react.dev/reference/rsc/server-components"
rel="nofollow">docs</a> for how to support React Server Components.</li>
</ul>
<h2>Deprecations</h2>
<ul>
<li>Deprecated: <code>element.ref</code> access: React 19 supports ref
as a prop, so we’re deprecating <code>element.ref</code> in favor of
<code>element.props.ref</code>. Accessing will result in a warning.</li>
<li><code>react-test-renderer</code>: In React 19, react-test-renderer
logs a deprecation warning and has switched to concurrent rendering for
web usage. We recommend migrating your tests to @
testinglibrary.com/docs/react-testing-library/intro/) or @
testingesting-library.com/docs/react-native-testing-library/intro)</li>
</ul>
<h2>Breaking Changes</h2>
<p>React 19 brings in a number of breaking changes, including the
removals of long-deprecated APIs. We recommend first upgrading to
<code>18.3.1</code>, where we've added additional deprecation warnings.
Check out the <a
href="https://19.react.dev/blog/2024/04/25/react-19-upgrade-guide"
rel="nofollow">upgrade guide</a> for more details and guidance on
codemodding.</p>
<h3>React</h3>
<ul>
<li>New JSX Transform is now required: We introduced <a
href="https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html"
rel="nofollow">a new JSX transform</a> in 2020 to improve bundle size
and use JSX without importing React. In React 19, we’re adding
additional improvements like using ref as a prop and JSX speed
improvements that require the new transform.</li>
<li>Errors in render are not re-thrown: Errors that are not caught by an
Error Boundary are now reported to window.reportError. Errors that are
caught by an Error Boundary are reported to console.error. We’ve
introduced <code>onUncaughtError</code> and <code>onCaughtError</code>
methods to <code>createRoot</code> and <code>hydrateRoot</code> to
customize this error handling.</li>
<li>Removed: <code>propTypes</code>: Using <code>propTypes</code> will
now be silently ignored. If required, we recommend migrating to
TypeScript or another type-checking solution.</li>
<li>Removed: <code>defaultProps</code> for functions: ES6 default
parameters can be used in place. Class components continue to support
<code>defaultProps</code> since there is no ES6 alternative.</li>
<li>Removed: <code>contextTypes</code> and <code>getChildContext</code>:
Legacy Context for class components has been removed in favor of the
<code>contextType</code> API.</li>
<li>Removed: string refs: Any usage of string refs need to be migrated
to ref callbacks.</li>
<li>Removed: Module pattern factories: A rarely used pattern that can be
migrated to regular functions.</li>
<li>Removed: <code>React.createFactory</code>: Now that JSX is broadly
supported, all <code>createFactory</code> usage can be migrated to JSX
components.</li>
<li>Removed: <code>react-test-renderer/shallow</code>: This has been a
re-export of <a
href="https://redirect.github.com/enzymejs/react-shallow-renderer">react-shallow-renderer</a>
since React 18. If needed, you can continue to use the third-party
package directly. We recommend using @
testinglibrary.com/docs/react-testing-library/intro/) or @
testingesting-library.com/docs/react-native-testing-library/intro)
instead.</li>
</ul>
<h3>React DOM</h3>
<ul>
<li>Removed: <code>react-dom/test-utils</code>: We’ve moved
<code>act</code> from <code>react-dom/test-utils</code> to react. All
other utilities have been removed.</li>
<li>Removed: <code>ReactDOM</code>.<code>render</code>,
<code>ReactDOM</code>.<code>hydrate</code>: These have been removed in
favor of the concurrent equivalents:
<code>ReactDOM</code>.<code>createRoot</code> and
<code>ReactDOM.hydrateRoot</code>.</li>
<li>Removed: <code>unmountComponentAtNode</code>: Removed in favor of
<code>root.unmount()</code>.</li>
<li>Removed: <code>ReactDOM</code>.<code>findDOMNode</code>: You can
replace <code>ReactDOM</code>.<code>findDOMNode</code> with DOM
Refs.</li>
</ul>
<h2>Notable Changes</h2>
<h3>React</h3>
<ul>
<li><code>&lt;Context&gt;</code> as a provider: You can now render
<code>&lt;Context&gt;</code> as a provider instead of
<code>&lt;Context.Provider&gt;</code>.</li>
<li>Cleanup functions for refs: When the component unmounts, React will
call the cleanup function returned from the ref callback.</li>
<li><code>useDeferredValue</code> initial value argument: When provided,
<code>useDeferredValue</code> will return the initial value for the
initial render of a component, then schedule a re-render in the
background with the <code>deferredValue</code> returned.</li>
<li>Support for Custom Elements: React 19 now passes all tests on <a
href="https://custom-elements-everywhere.com/" rel="nofollow">Custom
Elements Everywhere</a>.</li>
<li>StrictMode changes: <code>useMemo</code> and
<code>useCallback</code> will now reuse the memoized results from the
first render, during the second render. Additionally, StrictMode will
now double-invoke ref callback functions on initial mount.</li>
<li>UMD builds removed: To load React 19 with a script tag, we recommend
using an ESM-based CDN such as <a href="http://esm.sh"
rel="nofollow">esm.sh</a>.</li>
</ul>
<h3>React DOM</h3>
<ul>
<li>Diffs for hydration errors: In the case of a mismatch, React 19 logs
a single error with a diff of the mismatched content.</li>
<li>Compatibility with third-party scripts and extensions: React will
now force a client re-render to fix up any mismatched content caused by
elements inserted by third-party JS.</li>
</ul>
<h2>TypeScript Changes</h2>
<p>The most common changes can be codemodded with <code>npx
types-react-codemod@latest preset-19
./path-to-your-react-ts-files</code>.</p>
<ul>
<li>Removed deprecated TypeScript types:
<ul>
<li><code>ReactChild</code> (replacement: <code>React.ReactElement |
number | string)</code></li>
<li><code>ReactFragment</code> (replacement:
<code>Iterable&lt;React.ReactNode&gt;</code>)</li>
<li><code>ReactNodeArray</code> (replacement:
<code>ReadonlyArray&lt;React.ReactNode&gt;</code>)</li>
<li><code>ReactText</code> (replacement: <code>number |
string</code>)</li>
<li><code>VoidFunctionComponent</code> (replacement:
<code>FunctionComponent</code>)</li>
<li><code>VFC</code> (replacement: <code>FC</code>)</li>
<li>Moved to <code>prop-types</code>: <code>Requireable</code>,
<code>ValidationMap</code>, <code>Validator</code>,
<code>WeakValidationMap</code></li>
<li>Moved to <code>create-react-class</code>:
<code>ClassicComponentClass</code>, <code>ClassicComponent</code>,
<code>ClassicElement</code>, <code>ComponentSpec</code>,
<code>Mixin</code>, <code>ReactChildren</code>, <code>ReactHTML</code>,
<code>ReactSVG</code>, <code>SFCFactory</code></li>
</ul>
</li>
<li>Disallow implicit return in refs: refs can now accept cleanup
functions. When you return something else, we can’t tell if you
intentionally returned something not meant to clean up or returned the
wrong value. Implicit returns of anything but functions will now
error.</li>
<li>Require initial argument to <code>useRef</code>: The initial
argument is now required to match <code>useState</code>,
<code>createContext</code> etc</li>
<li>Refs are mutable by default: Ref objects returned from
<code>useRef()</code> are now always mutable instead of sometimes being
immutable. This feature was too confusing for users and conflicted with
legit cases where refs were managed by React and manually written
to.</li>
<li>Strict <code>ReactElement</code> typing: The props of React elements
now default to <code>unknown</code> instead of <code>any</code> if the
element is typed as <code>ReactElement</code></li>
<li>JSX namespace in TypeScript: The global <code>JSX</code> namespace
is removed to improve interoperability with other libraries using JSX.
Instead, the JSX namespace is available from the React package:
<code>import { JSX } from 'react'</code></li>
<li>Better <code>useReducer</code> typings: Most <code>useReducer</code>
usage should not require explicit type arguments.<br>
For example,
<div class="highlight highlight-source-diff notranslate
position-relative overflow-auto"
data-snippet-clipboard-copy-content="-useReducer&lt;React.Reducer&lt;State,
Action&gt;&gt;(reducer)
+useReducer(reducer) "><pre><span class="pl-md"><span
class="pl-md">-</span>useReducer&lt;React.Reducer&lt;State,
Action&gt;&gt;(reducer) </span>
<span class="pl-mi1"><span class="pl-mi1">+</span>useReducer(reducer)
</span></pre></div>
or
<div class="highlight highlight-source-diff notranslate
position-relative overflow-auto"
data-snippet-clipboard-copy-content="-useReducer&lt;React.Reducer&lt;State,
Action&gt;&gt;(reducer)
+useReducer&lt;State, [Action]&gt;(reducer)"><pre><span
class="pl-md"><span
class="pl-md">-</span>useReducer&lt;React.Reducer&lt;State,
Action&gt;&gt;(reducer) </span>
<span class="pl-mi1"><span class="pl-mi1">+</span>useReducer&lt;State,
[Action]&gt;(reducer)</span></pre></div>
</li>
</ul>
<h2>All Changes</h2>
<h3>React</h3>
<ul>
<li>Add support for async Actions (<a
href="https://redirect.github.com/facebook/react/pull/26621"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/26621/hovercard">#26621</a>, <a
href="https://redirect.github.com/facebook/react/pull/26726"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/26726/hovercard">#26726</a>, <a
href="https://redirect.github.com/facebook/react/pull/28078"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/28078/hovercard">#28078</a>, <a
href="https://redirect.github.com/facebook/react/pull/28097"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/28097/hovercard">#28097</a>, <a
href="https://redirect.github.com/facebook/react/pull/29226"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/29226/hovercard">#29226</a>, <a
href="https://redirect.github.com/facebook/react/pull/29618"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/29618/hovercard">#29618</a>, <a
href="https://redirect.github.com/facebook/react/pull/29670"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/29670/hovercard">#29670</a>, <a
href="https://redirect.github.com/facebook/react/pull/26716"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/26716/hovercard">#26716</a> by
<a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/acdlite/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/acdlite">@ acdlite</a> and <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/sebmarkbage/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/sebmarkbage">@ sebmarkbage</a>)</li>
<li>Add <code>useActionState()</code> hook to update state based on the
result of a Form Action (<a
href="https://redirect.github.com/facebook/react/pull/27270"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27270/hovercard">#27270</a>, <a
href="https://redirect.github.com/facebook/react/pull/27278"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27278/hovercard">#27278</a>, <a
href="https://redirect.github.com/facebook/react/pull/27309"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27309/hovercard">#27309</a>, <a
href="https://redirect.github.com/facebook/react/pull/27302"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27302/hovercard">#27302</a>, <a
href="https://redirect.github.com/facebook/react/pull/27307"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27307/hovercard">#27307</a>, <a
href="https://redirect.github.com/facebook/react/pull/27366"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27366/hovercard">#27366</a>, <a
href="https://redirect.github.com/facebook/react/pull/27370"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27370/hovercard">#27370</a>, <a
href="https://redirect.github.com/facebook/react/pull/27321"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27321/hovercard">#27321</a>, <a
href="https://redirect.github.com/facebook/react/pull/27374"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27374/hovercard">#27374</a>, <a
href="https://redirect.github.com/facebook/react/pull/27372"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27372/hovercard">#27372</a>, <a
href="https://redirect.github.com/facebook/react/pull/27397"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27397/hovercard">#27397</a>, <a
href="https://redirect.github.com/facebook/react/pull/27399"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27399/hovercard">#27399</a>, <a
href="https://redirect.github.com/facebook/react/pull/27460"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27460/hovercard">#27460</a>, <a
href="https://redirect.github.com/facebook/react/pull/28557"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/28557/hovercard">#28557</a>, <a
href="https://redirect.github.com/facebook/react/pull/27570"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27570/hovercard">#27570</a>, <a
href="https://redirect.github.com/facebook/react/pull/27571"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/27571/hovercard">#27571</a>, <a
href="https://redirect.github.com/facebook/react/pull/28631"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/28631/hovercard">#28631</a>, <a
href="https://redirect.github.com/facebook/react/pull/28788"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/28788/hovercard">#28788</a>, <a
href="https://redirect.github.com/facebook/react/pull/29694"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/29694/hovercard">#29694</a>, <a
href="https://redirect.github.com/facebook/react/pull/29695"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/29695/hovercard">#29695</a>, <a
href="https://redirect.github.com/facebook/react/pull/29694"
data-hovercard-type="pull_request"
data-hovercard-url="/facebook/react/pull/29694/hovercard">#29694</a>, <a
href="https://redirect.github.com/facebook/react/pull/29665"
data-hoverca

[Page truncated to keep GeezerVison snappy.]

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.