Commit Graph

533 Commits

Author SHA1 Message Date
rickhanlonii 573c95d434 Use react@17 for useSyncExternalStore shim tests (#28055)
The tests for the shim need to test with ReactDOM.render in React 17.

DiffTrain build for commit https://github.com/facebook/react/commit/ee1eb4826f4f7beb4e06f2c15f03145bb5bddf5b.
2024-01-24 16:33:06 +00:00
rickhanlonii 381550ee00 Convert ReactDOMFiberAsync to createRoot (#28067)
DiffTrain build for commit https://github.com/facebook/react/commit/6480eea157b033996a11264ae34993e2305833e8.
2024-01-24 16:02:26 +00:00
rickhanlonii 47686f2466 Convert ReactCompositeComponentNestedState to createRoot (#28066)
DiffTrain build for commit https://github.com/facebook/react/commit/3d9b201327706cfc183eb3e1437c2d1663b42dd0.
2024-01-24 16:01:55 +00:00
kassens 36cfff30fa Convert ReactServerRenderingHydration-test to createRoot (partially) (#28010)
Convert ReactServerRenderingHydration-test to createRoot (partially)

Some tests seem to be specifically testing the legacy APIs, maybe we
need to keep those around. Keeping this PR to the simple updates.

DiffTrain build for commit https://github.com/facebook/react/commit/f161ceaa743fc14ef472e9d7b3e5a0b99ed9e970.
2024-01-24 15:44:07 +00:00
rickhanlonii b9f523823f Convert ReactDOMTestSelectors-test.js to createRoot (#27993)
Straightforward adding createRoot and act

DiffTrain build for commit https://github.com/facebook/react/commit/4217d324ae5766b3201e682bb4d67b8855652694.
2024-01-24 04:06:33 +00:00
jackpope 469bf1bd00 Use createRoot in ReactEventIndependence-test (#28052)
DiffTrain build for commit https://github.com/facebook/react/commit/46174f16ed304743eb4ad37ad95bd5109dd72e8e.
2024-01-23 22:38:39 +00:00
jackpope 6b5448b716 Use createRoot in ReactART-test (#28060)
Stacked on #28059

---------

DiffTrain build for commit https://github.com/facebook/react/commit/6e03d0df82020a77a8c6afff7ef31a4f6d31911e.
2024-01-23 22:29:52 +00:00
jackpope 977f157007 Remove ReactTestUtils from ReactArt-test (#28059)
DiffTrain build for commit https://github.com/facebook/react/commit/9e13800e5731435a1e8ff4bd0266e7cd4adc8d4f.
2024-01-23 22:10:40 +00:00
kassens dc6edec7c8 Convert ReactDOMComponent-test to createRoot (#28034)
Convert ReactDOMComponent-test to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/b2d637128c89d450355622379e97c6c6b1c79435.
2024-01-23 15:08:46 +00:00
kassens 5efd4f41ca Fix ReactFreshIntegration-test not running all tests as assumed (#28033)
Fix ReactFreshIntegration-test not running all tests as assumed

`testCommon` was executed twice without setting `compileDestructuring`
ever to true.
This fixes this and removes one layer of abstraction in this test by
using `describe.each`.

DiffTrain build for commit https://github.com/facebook/react/commit/cb9899955b3d2c6e1e4477585f06068c2007efec.
2024-01-23 15:04:17 +00:00
eps1lon fdb6643ef4 Convert ReactMountDestruction (partially) to createRoot (#28004)
DiffTrain build for commit https://github.com/facebook/react/commit/bf32989264ff2faa9a009550401f573f29db4df2.
2024-01-23 09:35:12 +00:00
jackpope e9d4424784 Use createRoot for ReactTreeTraversal-test (#28051)
DiffTrain build for commit https://github.com/facebook/react/commit/2f803b47c7d225c9199275b7ddd255a23f60d929.
2024-01-22 22:17:12 +00:00
rickhanlonii 8df570a650 Convert ReactElementJSX to createRoot (#28012)
DiffTrain build for commit https://github.com/facebook/react/commit/ec19db4266b72ad8d94f851c050eb46c2c4d031a.
2024-01-22 20:55:09 +00:00
eps1lon 2000d9fded Convert describeComponentFrame to createRoot (#28001)
DiffTrain build for commit https://github.com/facebook/react/commit/e1d20fc0c0b671601389b8c48a84a38e9c535654.
2024-01-22 14:13:26 +00:00
eps1lon 3c1571636e Convert ReactDOMOption to createRoot (#28002)
DiffTrain build for commit https://github.com/facebook/react/commit/206934f0270d248b9eec186e2f70b0c7a4f99e1d.
2024-01-22 08:26:46 +00:00
rickhanlonii 23d1832857 Convert ReactError-test to createRoot (#27995)
DiffTrain build for commit https://github.com/facebook/react/commit/29fbf6f62625c4262035f931681c7b7822ca9843.
2024-01-19 19:40:31 +00:00
kassens 515f64a331 Convert getEventKey-test to createRoot (#28006)
Convert getEventKey-test to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/4c63dc7bddeea8b44466e918708ea44f76b05378.
2024-01-19 18:55:55 +00:00
kassens 202eff304a Convert ReactUpdaters-test.internal to createRoot (#28005)
Convert ReactUpdaters-test.internal to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/64d0c94724bea32fa41d6b21cc4ee4938473be1e.
2024-01-19 18:41:42 +00:00
kassens 869f6cfd70 Convert SyntheticKeyboardEvent-test to createRoot (#28007)
Convert SyntheticKeyboardEvent-test to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/624b51388b25143398a71e42225c612a9a785218.
2024-01-19 18:40:37 +00:00
kassens d52e7f3aec Convert ReactDOM-test to createRoot (#28009)
Convert ReactDOM-test to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/24d1c6f0fa28f95e5ea5f9fa23c31a1058e2d1a1.
2024-01-19 18:39:55 +00:00
kassens 2df4607f9c Convert dangerouslySetInnerHTML-test to createRoot (#28008)
Convert dangerouslySetInnerHTML-test to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/a2eaa21ac70ef898535479cb9fc9ea546854e072.
2024-01-19 18:39:24 +00:00
eps1lon a985119f5d Convert ReactFreshMultipleRenderer to createRoot (#28000)
DiffTrain build for commit https://github.com/facebook/react/commit/4c58fc2ad8f1055f9b543147b283e5a3f795fd27.
2024-01-19 17:28:10 +00:00
eps1lon 1f0fe878ad Convert ReactErrorLoggingRecovery to createRoot (#28003)
DiffTrain build for commit https://github.com/facebook/react/commit/601dba82175edd321c833395514081fe3aa6f445.
2024-01-19 17:11:42 +00:00
rickhanlonii 4eeb791efd Convert ReactFunctionComponent to createRoot (#27997)
DiffTrain build for commit https://github.com/facebook/react/commit/feed8f3f95836a99eeaf5dc64d1c9ed62217c1de.
2024-01-19 03:36:59 +00:00
rickhanlonii ac8a888afc Update error decoder URL (#27240)
Updates the error decoder to the URL for the new docs site.

- Switches the domain from reactjs.org to react.dev
- Switches to put the error code in the URL for SSG
- All params are still in the query

Example without args:

- Before: `https://reactjs.org/docs/error-decoder.html?invariant=200`
- After: ` https://react.dev/errors/200`

Example with args:
- Before:
`https://reactjs.org/docs/error-decoder.html?invariant=124?args[]=foo&args[]=bar
`
- After: ` https://react.dev/errors/124?args[]=foo&args[]=bar`

Requires: https://github.com/reactjs/react.dev/pull/6214

---------

Co-authored-by: Jan Kassens <jkassens@meta.com>

DiffTrain build for commit https://github.com/facebook/react/commit/b3003047101b4c7a643788a8faf576f7e370fb45.
2024-01-18 02:45:40 +00:00
acdlite 8d091c6f8a Remove client caching from cache() API (#27977)
We haven't yet decided how we want `cache` to work on the client. The
lifetime of the cache is more complex than on the server, where it only
has to live as long as a single request.

Since it's more important to ship this on the server, we're removing the
existing behavior from the client for now. On the client (i.e. not a
Server Components environment) `cache` will have not have any caching
behavior. `cache(fn)` will return the function as-is.

We intend to implement client caching in a future major release. In the
meantime, it's only exposed as an API so that Shared Components can use
per-request caching on the server without breaking on the client.

DiffTrain build for commit https://github.com/facebook/react/commit/5c607369ceebe56d85175df84b7b6ad58dd25e1f.
2024-01-17 01:31:50 +00:00
acdlite 845c10a655 Refactor React Server entrypoint to not depend on the client one (#27940)
This refactors the Server Components entrypoint for the `react` package
(ReactServer.js) so that it doesn't depend on the client entrypoint
(React.js). I also renamed React.js to ReactClient.js to make the
separation clearer.

This structure will make it easier to add client-only and server-only
features.

DiffTrain build for commit https://github.com/facebook/react/commit/f16344ea6db5bcc108de80dbc39a41ec28e8210d.
2024-01-17 01:23:48 +00:00
acdlite e16614ff24 Rename "shared subset" to "server" (#27939)
The internal file ReactSharedSubset is what the `react` module resolves
to when imported from a Server Component environment. We gave it this
name because, originally, the idea was that Server Components can access
a subset of the APIs available on the client.

However, since then, we've also added APIs that can _only_ by accessed
on the server and not the client. In other words, it's no longer a
subset, it's a slightly different overlapping set.

So this commit renames ReactSharedSubet to ReactServer and updates all
the references. This does not affect the public API, only our internal
implementation.

DiffTrain build for commit https://github.com/facebook/react/commit/5d1b15a4f06fa93e76cd89f37ea5bfd62cc66183.
2024-01-17 01:02:47 +00:00
acdlite d2a2a66614 Fix: useOptimistic should return passthrough value when there are no updates pending (#27936)
This fixes a bug that happened when the canonical value passed to
useOptimistic without an accompanying call to setOptimistic. In this
scenario, useOptimistic should pass through the new canonical value.

I had written tests for the more complicated scenario, where a new value
is passed while there are still pending optimistic updates, but not this
simpler one.

DiffTrain build for commit https://github.com/facebook/react/commit/60a927d04ad3888facebcdf7da620aa1cfc9528f.
2024-01-14 02:42:09 +00:00
kassens cbb38c72ac Upgrade ReactDOMShorthandCSSPropertyCollision-test to createRoot (#27924)
Upgrade ReactDOMShorthandCSSPropertyCollision-test to createRoot

Using the codemod from #27921 as a starting point, this migrates the
test to `createRoot`.

DiffTrain build for commit https://github.com/facebook/react/commit/33068c9db9153a479bb29d138397cb9c32fabfdd.
2024-01-12 20:55:25 +00:00
sebmarkbage caf453249f Use getComponentNameFromType for debug info for the key warning (#27930)
If this is a client reference we shouldn't dot into it, which would
throw in the proxy.

Interestingly our client references don't really have a `name`
associated with them for debug information so a component type doesn't
show up in error logs even though it seems like it should.

DiffTrain build for commit https://github.com/facebook/react/commit/0ac3ea471fbcb7d79bc7d36179e960c72c779e76.
2024-01-11 22:29:00 +00:00
hoxyq 2a6d5aca86 refactor[isChildPublicInstance]: don't leak ReactNativeFiberHostComponent to Fabric implementation (#27923)
While inspecting the build artifacts for Fabric in
https://www.internalfb.com/diff/D51816108, I've noticed it has some
leaking implementation details from Paper, such as
`ReactNativeFiberHostComponent`.

The reason for it is the single implementation of
`isChildPublicInstance` in `ReactNativePublicCompat`, in which we were
using `instanceof ReactNativeFiberHostComponent`.

This new implementation removes the `ReactNativeFiberHostComponent`
leak, but decreases the Flow coverage.

DiffTrain build for commit https://github.com/facebook/react/commit/6639ed3b3a44f7736beb629144a7996145008f09.
2024-01-11 14:31:15 +00:00
kassens 772935f732 Upgrade Flow to 0.216.0 (#27922)
Upgrade Flow to 0.216.0

```
yarn add -W flow-bin flow-remove-types hermes-parser hermes-eslint
```

DiffTrain build for commit https://github.com/facebook/react/commit/49439b4db858b2cfc17a601ae087d392479121da.
2024-01-10 18:48:41 +00:00
kassens 9a55663aa3 Convert ReactPureComponent-test to createRoot (#27917)
Convert ReactPureComponent-test to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/08cd087cada28bf05165b87b6e31a97c6ac598b4.
2024-01-10 15:23:18 +00:00
kassens 5d47dbc459 Convert ReactComponentLifeCycle-test to createRoot (#27916)
Convert ReactComponentLifeCycle-test to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/2594caa09e0aca49493cd62659c1e3d1d3488a7e.
2024-01-10 15:21:46 +00:00
kassens 367597a2e2 Convert ReactElement-test to createRoot (#27918)
Convert ReactElement-test to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/344a6675a9974d9e7b14542dd4e8bddb81a235e5.
2024-01-10 15:21:14 +00:00
noahlemen c6d8e5452b re-add dynamic feature flags for isInputPending (#27919)
## Summary

these were removed in https://github.com/facebook/react/pull/26617. adds
them back so we can conduct another experiment.

## How did you test this change?
`yarn test-www`

DiffTrain build for commit https://github.com/facebook/react/commit/c81f4e02bab9d03e1583047d041fdb5e4eb19415.
2024-01-09 22:25:38 +00:00
kassens 8c55ade707 Convert createReactClassIntegration-test to createRoot (#27914)
Convert createReactClassIntegration-test to createRoot

DiffTrain build for commit https://github.com/facebook/react/commit/9723093df319f06886fe488d6d88ff615a3e8fc3.
2024-01-09 20:35:28 +00:00
kassens 0460bbf487 Convert DOMPropertyOperations-test to createRoot (#27911)
Convert DOMPropertyOperations-test to createRoot

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/27911).
* #27914
* __->__ #27911

DiffTrain build for commit https://github.com/facebook/react/commit/ef2859d50bb6b4b31b304f4fe4bb43dc273a9b54.
2024-01-09 20:35:03 +00:00
kassens e78782492e Bump follow-redirects from 1.7.0 to 1.15.4 (#27909)
Bumps
[follow-redirects](https://github.com/follow-redirects/follow-redirects)
from 1.7.0 to 1.15.4.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/65858205e59f1e23c9bf173348a7a7cbb8ac47f5"><code>6585820</code></a>
Release version 1.15.4 of the npm package.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/7a6567e16dfa9ad18a70bfe91784c28653fbf19d"><code>7a6567e</code></a>
Disallow bracketed hostnames.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/05629af696588b90d64e738bc2e809a97a5f92fc"><code>05629af</code></a>
Prefer native URL instead of deprecated url.parse.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/1cba8e85fa73f563a439fe460cf028688e4358df"><code>1cba8e8</code></a>
Prefer native URL instead of legacy url.resolve.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/72bc2a4229bc18dc9fbd57c60579713e6264cb92"><code>72bc2a4</code></a>
Simplify _processResponse error handling.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/3d42aecdca39b144a0a2f27ea134b4cf67dd796a"><code>3d42aec</code></a>
Add bracket tests.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/bcbb096b32686ecad6cd34235358ed6f2217d4f0"><code>bcbb096</code></a>
Do not directly set Error properties.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/192dbe7ce671ecad813c074bffe3b3f5d3680fee"><code>192dbe7</code></a>
Release version 1.15.3 of the npm package.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/bd8c81e4f32d12f28a35d265f88b1716703687c6"><code>bd8c81e</code></a>
Fix resource leak on destroy.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/9c728c314b06f9595dcd7f245d40731e8a27d79f"><code>9c728c3</code></a>
Split linting and testing.</li>
<li>Additional commits viewable in <a
href="https://github.com/follow-redirects/follow-redirects/compare/v1.7.0...v1.15.4">compare
view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.7.0&new-version=1.15.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/facebook/react/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

DiffTrain build for commit https://github.com/facebook/react/commit/9c08b96a788196e6ed42c9e6c934b0296a8bcd99.
2024-01-09 17:09:46 +00:00
kassens c84fa10017 Bump follow-redirects from 1.14.0 to 1.15.4 in /fixtures/concurrent/time-slicing (#27907)
Bumps
[follow-redirects](https://github.com/follow-redirects/follow-redirects)
from 1.14.0 to 1.15.4.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/65858205e59f1e23c9bf173348a7a7cbb8ac47f5"><code>6585820</code></a>
Release version 1.15.4 of the npm package.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/7a6567e16dfa9ad18a70bfe91784c28653fbf19d"><code>7a6567e</code></a>
Disallow bracketed hostnames.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/05629af696588b90d64e738bc2e809a97a5f92fc"><code>05629af</code></a>
Prefer native URL instead of deprecated url.parse.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/1cba8e85fa73f563a439fe460cf028688e4358df"><code>1cba8e8</code></a>
Prefer native URL instead of legacy url.resolve.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/72bc2a4229bc18dc9fbd57c60579713e6264cb92"><code>72bc2a4</code></a>
Simplify _processResponse error handling.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/3d42aecdca39b144a0a2f27ea134b4cf67dd796a"><code>3d42aec</code></a>
Add bracket tests.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/bcbb096b32686ecad6cd34235358ed6f2217d4f0"><code>bcbb096</code></a>
Do not directly set Error properties.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/192dbe7ce671ecad813c074bffe3b3f5d3680fee"><code>192dbe7</code></a>
Release version 1.15.3 of the npm package.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/bd8c81e4f32d12f28a35d265f88b1716703687c6"><code>bd8c81e</code></a>
Fix resource leak on destroy.</li>
<li><a
href="https://github.com/follow-redirects/follow-redirects/commit/9c728c314b06f9595dcd7f245d40731e8a27d79f"><code>9c728c3</code></a>
Split linting and testing.</li>
<li>Additional commits viewable in <a
href="https://github.com/follow-redirects/follow-redirects/compare/v1.14.0...v1.15.4">compare
view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.14.0&new-version=1.15.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/facebook/react/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

DiffTrain build for commit https://github.com/facebook/react/commit/31603f19d7114b751e89846d6eec73a8fbcdae71.
2024-01-09 16:09:52 +00:00
sebmarkbage 0bdbe4387b [Fizz] Fix Client Render after Postpone (#27905)
If we end up client rendering a boundary due to an error after we have
already injected a postponed hole in that boundary we'll end up trying
to target a missing segment. Since we never insert segments for an
already errored boundary into the HTML. Normally an errored prerender
wouldn't be used but if it is, such as if it was an intentional client
error it triggers this case. Those should really be replaced with
postpones though.

This is a bit annoying since we eagerly build up the postponed path. I
took the easy route here and just cleared out the suspense boundary
itself from having any postponed slots. However, this still creates an
unnecessary replay path along the way to the boundary. We could probably
walk the path and remove any empty parent nodes.

What is worse is that if this is the only thing that postponed, we'd
still generate a postponed state even though there's actually nothing to
resume. Since this is a bit of an edge case already maybe it's fine.

In my test I added a check for the `error` event on `window` since this
error only surfaces by throwing an ignored error. We should really do
that globally for all tests. Our tests should fail by default if there's
an error logged to the window.

DiffTrain build for commit https://github.com/facebook/react/commit/f9dddcbbb1c0b73f974e78b9488927b778630682.
2024-01-09 04:57:11 +00:00
acdlite 92eda60c24 Fix: useDeferredValue initialValue suspends forever without switching to final (#27888)
Fixes a bug in the experimental `initialValue` option for
`useDeferredValue` (added in #27500).

If rendering the `initialValue` causes the tree to suspend, React should
skip it and switch to rendering the final value instead. It should not
wait for `initialValue` to resolve.

This is not just an optimization, because in some cases the initial
value may _never_ resolve — intentionally. For example, if the
application does not provide an instant fallback state. This capability
is, in fact, the primary motivation for the `initialValue` API.

I mostly implemented this correctly in the original PR, but I missed
some cases where it wasn't working:

- If there's no Suspense boundary between the `useDeferredValue` hook
and the component that suspends, and we're not in the shell of the
transition (i.e. there's a parent Suspense boundary wrapping the
`useDeferredValue` hook), the deferred task would get incorrectly
dropped.
- Similarly, if there's no Suspense boundary between the
`useDeferredValue` hook and the component that suspends, and we're
rendering a synchronous update, the deferred task would get incorrectly
dropped.

What these cases have in common is that it causes the `useDeferredValue`
hook itself to be replaced by a Suspense fallback. The fix was the same
for both. (It already worked in cases where there's no Suspense fallback
at all, because those are handled differently, at the root.)

The way I discovered this was when investigating a particular bug in
Next.js that would happen during a 'popstate' transition (back/forward),
but not during a regular navigation. That's because we render popstate
transitions synchronously to preserve browser's scroll position — which
in this case triggered the second scenario above.

DiffTrain build for commit https://github.com/facebook/react/commit/f1039be4a48384e7e4b0a87d4d92c48e900053b9.
2024-01-08 04:22:00 +00:00
kassens 89da9fc1c9 [churn] remove Node 19 from dev engines, add 21 (#27870)
This allows running `yarn` with Node 21 installed, also removes Node 19
which is no longer supported according to
https://nodejs.org/en/about/previous-releases

DiffTrain build for commit https://github.com/facebook/react/commit/1d5667a1273386f84e416059af7b6aba069e068e.
2024-01-02 19:44:59 +00:00
kassens 790a57633b [flow] upgrade to 0.225.1 (#27871)
This Flow upgrade includes 2 fixes:
- Remove `React$StatelessFunctionalComponent` as that was replaced by
just `React$AbstractComponent` as Flow doesn't make any guarantees, see
the Flow change here:
https://github.com/facebook/flow/commit/521317c48f44ffb5eac072a7b2548a72b0745095
- Flow no longer allows `number` type indexing into objects which
discovered an incorrect type that is actually an array of the data.

Used this command to upgrade
```
yarn add -W flow-bin flow-remove-types hermes-parser hermes-eslint
```
and ran `yarn flow-ci` to check for errors in different configurations.

DiffTrain build for commit https://github.com/facebook/react/commit/45d61cf7effdba6bbd9835bb427c99c95beb7e17.
2024-01-02 19:44:49 +00:00
sebmarkbage 0a8c177bc1 [Fizz] Only compute component stacks in DEV and prerenders (#27850)
If you have a lot of intentional throws (or postpones) from client-only
rendering then computing the stack is too much.

DiffTrain build for commit https://github.com/facebook/react/commit/c5b9375767e2c4102d7e5559d383523736f1c902.
2023-12-19 23:08:48 +00:00
alunyov df9e40450b [RSC @ Meta] Simplify implementation of isClientReference, getClientReferenceKey, resolveClientReferenceMetadata (#27839)
For clientReferences we can just check the instance of the
`clientReference`.
The implementation of `isClientReference` is provided via configuration.
The class for ClientReference has to implement an interface that has
`getModuleId() method.

DiffTrain build for commit https://github.com/facebook/react/commit/cb2439624f43c510007f65aea5c50a8bb97917e4.
2023-12-19 14:22:41 +00:00
hoxyq 0f1f06d81b fix[devtools/e2e]: add fallback for act in integration tests (#27842)
https://github.com/facebook/react/pull/27805 broke integration tests for
React DevTools with React 17, these changes introduce a fallback for
such case when `act` is not available in `react`, but available in
`react-dom`, like before.

DiffTrain build for commit https://github.com/facebook/react/commit/3e00e58a6ac7f73a3660f31d3129fb06d344167e.
2023-12-17 13:22:35 +00:00
rickhanlonii 4154783f4f docs: fix typo in README.md (#27841)
DiffTrain build for commit https://github.com/facebook/react/commit/8b1547b671f9ea9a2db38f2404557fb59b84afc0.
2023-12-16 23:42:41 +00:00
sebmarkbage c8618d36d2 [Flight] Wire up async_hooks in Node.js DEV for inspecting Promises (#27840)
This wires up the use of `async_hooks` in the Node build (as well as the
Edge build when a global is available) in DEV mode only. This will be
used to track debug info about what suspended during an RSC pass.

Enabled behind a flag for now.

DiffTrain build for commit https://github.com/facebook/react/commit/8b8d265bd9a4cab7bbd04a9a13950fdc946ea51c.
2023-12-16 02:42:41 +00:00