Commit Graph

19167 Commits

Author SHA1 Message Date
Lauren Tan
4e482f4904 [ez] Remove circleci badge from readme
CircleCI is no longer in use in this repo: a6b5ed01ae

ghstack-source-id: b6234f11d1
Pull Request resolved: https://github.com/facebook/react/pull/30502
2024-07-29 13:26:14 -04:00
Mofei Zhang
a8f5c4e16d [compiler] patch: retain UpdateExpression for globals
ghstack-source-id: aff6606f85
Pull Request resolved: https://github.com/facebook/react/pull/30471
2024-07-29 13:18:45 -04:00
Mofei Zhang
2a9274a73e [compiler] Repro: updates to globals should be retained
ghstack-source-id: 7ee813c0d7
Pull Request resolved: https://github.com/facebook/react/pull/30470
2024-07-29 13:18:45 -04:00
Mofei Zhang
e215aa1160 [compiler] Fix FBT whitespace handling again (again (again))
ghstack-source-id: 00a86e41cf
Pull Request resolved: https://github.com/facebook/react/pull/30451
2024-07-29 13:18:45 -04:00
Mofei Zhang
e0acd77aab [compiler] Todo for fbt with multiple pronoun/plural
ghstack-source-id: 77b6980c2b
Pull Request resolved: https://github.com/facebook/react/pull/30437
2024-07-29 13:18:45 -04:00
Mofei Zhang
a15e8d7cdc [compiler][repro] Test fixture for fbt plural bug
ghstack-source-id: 222e7312c0
Pull Request resolved: https://github.com/facebook/react/pull/30432
2024-07-29 13:18:45 -04:00
Lauren Tan
28b7f0bb71 [ci] Remove references to CIRCLE_NODE_{TOTAL,INDEX}
These env variables were used for circlci parallelization and can now be
removed.

ghstack-source-id: 224c47194d
Pull Request resolved: https://github.com/facebook/react/pull/30501
2024-07-29 13:04:00 -04:00
Lauren Tan
164af898c4 [ci] Remove jestSequencer
This was previously used for circleci parallelization but is no longer
needed.

ghstack-source-id: d8c1005e09
Pull Request resolved: https://github.com/facebook/react/pull/30500
2024-07-29 13:04:00 -04:00
Lauren Tan
39acfdb3be [ci] Fix ci prep script
During params parsing for this script, it previously would call out to
CircleCI for a build ID, but this is no longer needed.

ghstack-source-id: 9c70824498
Pull Request resolved: https://github.com/facebook/react/pull/30499
2024-07-29 13:03:59 -04:00
Lauren Tan
03072a7a11 [ci] Fix prereleases reusable workflow
Turns out I had configured the reusable workflow with the wrong `on`
command.

Also removes the workflow_dispatch config from the nightly workflow as
that was not meant to be triggered manually.

ghstack-source-id: 426d07279d
Pull Request resolved: https://github.com/facebook/react/pull/30498
2024-07-29 12:37:05 -04:00
Lauren Tan
a6b5ed01ae [ci] Delete .circleci
Everything has been migrated to GH. It's time to say goodbye...

ghstack-source-id: c7a9f49a72
Pull Request resolved: https://github.com/facebook/react/pull/30496
2024-07-29 11:29:29 -04:00
Lauren Tan
9af9764f55 [ci] Add prerelease workflows to GH actions
Migrates the last 2 remaining circleci jobs to GH actions. The behavior
of these workflows have been kept the same.

Overview:
- Reusable workflow `runtime_prereleases.yml` added
- Nightly workflow on cron triggers the reusable workflow with the
  current HEAD sha
- Manual workflow which can be triggered from the github UI with a
  `prerelease_commit_sha` which triggers the reusable workflow

ghstack-source-id: 84ef33c732
Pull Request resolved: https://github.com/facebook/react/pull/30495
2024-07-29 11:29:29 -04:00
Josh Story
d17e9d1ce5 [Fizz] Prerender fallbacks before children (#30483)
When prerendering it can be convenient to abort the prerender while
rendering. However if any Suspense fallbacks have not yet rendered
before the abort happens the fallback itself will error and cause the
nearest parent Suspense boundary to render a fallback instead.
Prerenders are by definition not time critical so the prioritization of
children over fallbacks which makes sense for render isn't similarly
motivated for prerender. Given this, this change updates fallback
rendering during a prerender to attempt the fallback before attempting
children.
2024-07-26 14:06:47 -07:00
Lauren Tan
b9af819f8b [ci] Fix invalid username and email in synthetic commit
ghstack-source-id: 951d0ef445
Pull Request resolved: https://github.com/facebook/react/pull/30486
2024-07-26 15:15:00 -04:00
Lauren Tan
c00e895c19 [ci] Update prepare-release-from-ci to dl from GH
Updates this script to download from GH actions instead, to prepare for
moving the cron jobs over to GH actions.

ghstack-source-id: 9bba9f2721
Pull Request resolved: https://github.com/facebook/react/pull/30485
2024-07-26 14:57:52 -04:00
Lauren Tan
0d022861d2 [ci] Refactor download-build-artifacts
Extracts out the code to download builds from GH into its own module so
that it can be reused later.

ghstack-source-id: 26687db971
Pull Request resolved: https://github.com/facebook/react/pull/30484
2024-07-26 14:57:51 -04:00
Jack Pope
1350a85980 Add unstable context bailout for profiling (#30407)
**This API is not intended to ship. This is a temporary unstable hook
for internal performance profiling.**

This PR exposes `unstable_useContextWithBailout`, which takes a compare
function in addition to Context. The comparison function is run to
determine if Context propagation and render should bail out earlier.
`unstable_useContextWithBailout` returns the full Context value, same as
`useContext`.

We can profile this API against `useContext` to better measure the cost
of Context value updates and gather more data around propagation and
render performance.

The bailout logic and test cases are based on
https://github.com/facebook/react/pull/20646

Additionally, this implementation allows multiple values to be compared
in one hook by returning a tuple to avoid requiring additional Context
consumer hooks.
2024-07-26 14:38:24 -04:00
Ahmed Abdelbaset
f7ee804c22 [compiler] Add git info to package.json files in compiler packages (#30475)
This PR adds the repository field to `compiler/packages/*/package.json`

| eslint-plugin-react-compiler | eslint-plugin-react-hooks |
| --- | --- |
|
![image](https://github.com/user-attachments/assets/3392a496-1ff1-4f36-ab96-cfbe1ed88693)
|
![image](https://github.com/user-attachments/assets/b0605dba-eef7-44fe-9484-979b4814d9fb)
|
2024-07-26 12:56:39 -04:00
Lauren Tan
c5f3a6f42f [circleci] Remove build_and_test workflow
Now that we've fully migrated the PR CI workflow (build_and_test) to GH,
we can fully delete the workflow altogether. This will break
https://react-builds.vercel.app/ unfortunately but I'll wait for
acdlite to come back from vacation and work with him to fix it.

The remaining jobs in circleci are for publishing prereleases of React
to npm. I'll work on migrating those next.

ghstack-source-id: 05f346829f
Pull Request resolved: https://github.com/facebook/react/pull/30480
2024-07-26 11:58:20 -04:00
Lauren Tan
0023cff871 [ci] Update runtime_commit_artifacts step versions
These were outdated and emitting warnings

ghstack-source-id: 2e22c29253
Pull Request resolved: https://github.com/facebook/react/pull/30479
2024-07-26 11:58:20 -04:00
Lauren Tan
2883d28b2d [ci] Unfork runtime_commit_artifacts
Promotes v2 to the primary workflow file so that we don't double write
to the protected branches.

Note: this may break DiffTrain temporarily, I will fix forward if so

ghstack-source-id: f6505a72f2
Pull Request resolved: https://github.com/facebook/react/pull/30477
2024-07-26 11:34:26 -04:00
Lauren Tan
417e93ca19 [ci] Add commit steps to new runtime_commit_artifacts_v2
Adds back the missing steps with a few tweaks to where previously some
`github` context value was referenced, I changed it to read from the
triggering workflow_run (ie the build on `main`) instead.

ghstack-source-id: 4b0fa135f0
Pull Request resolved: https://github.com/facebook/react/pull/30476
2024-07-26 11:34:25 -04:00
Josh Story
7f217d1d88 [Fiber] use srcset to trigger load even on img mount (#30351)
In https://github.com/facebook/react/pull/23316 we fixed a bug where
onload events were missed if they happened too early. This update adds
support for srcset to retrigger the load event. Firefox unfortunately
does not trigger a load even when you assign srcset so this won't work
in every browser when you use srcset without src however it does close a
gap in chrome at least
2024-07-25 15:46:45 -07:00
Lauren Tan
27d5dba884 [ci] Temporary fork runtime_commit_artifacts
Unfortunately creating a workflow that depends on another worfklow run
requires it to first be merged into main, so I can't really test porting
this without landing it first.

To do this safely, I've left the original job intact for DiffTrain and
added a forked file. This fork only currently downloads the artifact
from the HEAD commit in GH actions; I've removed the steps that push to
the protected branches for now while I test to see if this works as
expected.

This workflow needs to depend on the runtime_build_and_test workflow
being complete because otherwise it will fail since the artifacts
haven't been built yet.

ghstack-source-id: 0f9cebc525
Pull Request resolved: https://github.com/facebook/react/pull/30472
2024-07-25 18:09:32 -04:00
Lauren Tan
720a982a1f [ci] Remove devtools_regression_tests workflow from circleci
This has now been migrated to GH actions.

ghstack-source-id: 2dcc9ae5ad
Pull Request resolved: https://github.com/facebook/react/pull/30468
2024-07-25 17:27:38 -04:00
Lauren Tan
fe225e3a1f [ci] Add devtools regression workflow
More or less a straight copy from the circleci config. I spotted some
inefficiencies but will fix those later to make reviewing this easier.

ghstack-source-id: cb3456c602
Pull Request resolved: https://github.com/facebook/react/pull/30406
2024-07-25 17:27:38 -04:00
Lauren Tan
0a76aecbfa [ci] Cleanup run_devtools_e2e_tests
This was only used for build_and_test which has since been migrated to
gh actions and is now therefore unused. Looks like I missed this during
the previous cleanup.

ghstack-source-id: 278443951e
Pull Request resolved: https://github.com/facebook/react/pull/30467
2024-07-25 17:09:12 -04:00
Lauren Tan
a0e7ecfc6a Bump version to 0.0.0-experimental-ab3118d-20240725 2024-07-25 15:46:47 -04:00
Lauren Tan
83035ee299 Bump version to 0.0.0-experimental-9ed098e-20240725 2024-07-25 15:46:46 -04:00
Lauren Tan
789c257d79 Bump version to 0.0.0-experimental-334f00b-20240725 2024-07-25 15:46:45 -04:00
Lauren Tan
9f3bbb05ab [compiler] Make inserting outlined functions more resilient
To handle more cases, always append the synthetic outlined function as a
new child of the module rather than make assumptions about the original
function. This should handle whatever case where the original function
expression may be a child of a variety of parents

ghstack-source-id: 8581edb8be
Pull Request resolved: https://github.com/facebook/react/pull/30466
2024-07-25 15:38:19 -04:00
Lauren Tan
d529a43212 [compiler] Add repro for outlining in non VarDecls
ghstack-source-id: 7688987b02
Pull Request resolved: https://github.com/facebook/react/pull/30465
2024-07-25 15:38:19 -04:00
Lauren Tan
88bf4e197a [compiler] Always emit FuncDecl for outlined functions
Addresses follow up feedback from #30446. Since the outlined function is
guaranteed to have a module-scoped unique identifier name, we can
simplify the insertion logic for the outlined function to always emit a
function declaration rather than switch based on the original function
type. This is fine because the outlined function is synthetic anyway.

ghstack-source-id: 0a4d1f7b0a
Pull Request resolved: https://github.com/facebook/react/pull/30464
2024-07-25 15:38:18 -04:00
Sathya Gunsasekaran
c5fa460784 [compiler] Add tests for incorrect global mutation detection
If a function expression that mutates a global is passed as a prop,
we don't throw an error as we assume it's not called in render.

But if this function expression is captured in an object and passed down
as prop, we throw an error.

ghstack-source-id: 74cacee09f
Pull Request resolved: https://github.com/facebook/react/pull/30456
2024-07-25 17:47:20 +01:00
Sebastian Markbåge
e8df0cf9f7 Switch to binding the console with badging instead of calling it directly (#30461)
This is a major nit but this avoids an extra stack frame when we're
replaying logs.

Normally the `printToConsole` frame doesn't show up because it'd be
ignore listed.

<img width="421" alt="Screenshot 2024-07-25 at 11 49 39 AM"
src="https://github.com/user-attachments/assets/81334c2f-e19e-476a-871e-c4db9dee294e">

When you expand to show ignore listed frames a ton of other frames show
up.

<img width="516" alt="Screenshot 2024-07-25 at 11 49 47 AM"
src="https://github.com/user-attachments/assets/2ab8bdfb-464c-408d-9176-ee2fabc114b6">

The annoying thing about this frame is that it's at the top of the stack
where as typically framework stuff ends up at the bottom and something
you can ignore. The user space stack comes first.

With this fix there's no longer any `printToConsole` frame.

<img width="590" alt="Screenshot 2024-07-25 at 12 09 09 PM"
src="https://github.com/user-attachments/assets/b8365d53-31f3-43df-abce-172d608d3c9c">

Am I wiling to eat the added complexity and slightly slower performance
for this nit? Definitely.
2024-07-25 12:32:16 -04:00
Lauren Tan
66968535c6 Bump version to 0.0.0-experimental-176c31a-20240725 2024-07-25 12:27:06 -04:00
Lauren Tan
9f04494b8e Bump version to 0.0.0-experimental-47e15aa-20240725 2024-07-25 12:27:05 -04:00
Lauren Tan
2e800a81d3 Bump version to 0.0.0-experimental-f1f288c-20240725 2024-07-25 12:27:04 -04:00
Jack Pope
14a4699ff1 Remove allowConcurrentByDefault flag (#30445)
Following https://github.com/facebook/react/pull/30436

Concurrent by default strategy has been unshipped. Here we clean up the
`allowConcurrentByDefault` path and related logic/tests.

For now, this keeps the `concurrentUpdatesByDefaultOverride` argument in
`createContainer` and `createHydrationContainer` and ignores the value
to prevent more breaking changes to `react-reconciler` in the RC stage.
2024-07-25 11:59:50 -04:00
Sebastian Markbåge
c2d103594d Configure the requested environment and annotate tasks at boundary between environments (#30455)
This enables configuring the name of the requested environment.

When we currently use createTask, we start with a `"use server"`
annotation. This option basically configures that string.

I now also deal with the case when switching environments along the
owner path. If you go from `"Third Party"` to `"Server"` to `"Client"`,
it'll have a task named `"use third party"` at the root, then `"use
server"` and then finally `"use client"`.

We don't really have the concept of a Server Component making a request
during render to then create another Server Component. Really the inner
one should conceptually have the first one as its owner in that case. So
currently the inner one will always have a null owner. We could somehow
connect them in this server-to-server case.

We don't currently have a way to configure the `"use client"` option but
I figured maybe that could be inferred by the server environment that
the Flight Client is executed within.

Note: We did talk before about annotating each stack frame with the
environment. You can effectively do that manually when parsing
`rsc://React/{environment}/` from `captureOwnerStack`. However, we can't
do that natively. At least not without deeper integration. Because it's
the source map that's responsible for the actual function name of each
stack frame - not what we give it at runtime. So for the native stacks,
the task showing the change in environment is more practical.
2024-07-25 11:46:58 -04:00
Sebastian Markbåge
e5d22459ff [Flight] Include environment name both in the virtual URL and findSourceMapURL (#30452)
This way you can use the environment to know where to look for the
source map in case you have multiple server environments.

This becomes part of the public protocol since it's part of what you'll
parse out of the `rsc://React/` prefixed URLs inside of
`captureOwnerStack`.
2024-07-25 11:14:24 -04:00
Sebastian Markbåge
4b62400765 [Flight] Add filterStackFrame options to the RSC Server (#30447)
This lets you customize the filter, for example allowing node_modules or
filter out additional functions that you don't want to include when
sending the stack to the client.

Notably this doesn't filter out Server Components out of the parent
stack. Those are just like a view of the tree by name. Not virtual stack
frames.
2024-07-25 10:50:56 -04:00
Jack Pope
e4b4aac2a0 Fix existing usage of names/type in build command (#30450)
https://github.com/facebook/react/pull/30422 broke existing build
shortcuts.

Revert the usage of `names` (`_`) and `type` args.

`yarn build-for-devtools` / `yarn build-for-devtools-dev` / `yarn
build-for-devtools-prod` should all work again.

Moved the bundleType documentation into description so they can be fuzzy
matched. But a build like `yarn build --type FB_WWW_PROD` still works
when matched exactly.

There's probably a better way to document the positional `names` arg in
the `--help` command, but didn't see it when browsing the yargs docs so
let's just fix the existing builds for now.

Now:

```
% yarn build --help
yarn run v1.22.19
$ node ./scripts/rollup/build-all-release-channels.js --help
Options:
  --help                Show help                                                                                                                                             [boolean]
  --version             Show version number                                                                                                                                   [boolean]
  --releaseChannel, -r  Build the given release channel.                                                                                   [string] [choices: "experimental", "stable"]
  --index, -i           Worker id.                                                                                                                                             [number]
  --total, -t           Total number of workers.                                                                                                                               [number]
  --ci                  Run tests in CI                                                                                                                 [choices: "circleci", "github"]
  --type                Build the given bundle type. (NODE_ES2015,ESM_DEV,ESM_PROD,NODE_DEV,NODE_PROD,NODE_PROFILING,BUN_DEV,BUN_PROD,FB_WWW_DEV,FB_WWW_PROD,FB_WWW_PROFILING,RN_OSS_DE
                        V,RN_OSS_PROD,RN_OSS_PROFILING,RN_FB_DEV,RN_FB_PROD,RN_FB_PROFILING,BROWSER_SCRIPT)                                                                    [string]
  --pretty              Force pretty output.                                                                                                                                  [boolean]
  --sync-fbsource       Include to sync build to fbsource.                                                                                                                     [string]
  --sync-www            Include to sync build to www.                                                                                                                          [string]
  --unsafe-partial      Do not clean ./build first.     
```
2024-07-25 07:44:57 -04:00
Hendrik Liebau
76002254b7 Fix resolving of references to deduped props in lazy elements (#30441)
When a model references a deduped object of a blocked element that has
subsequently been turned into a lazy element, we need to wait for the
lazy element's chunk to resolve before resolving the reference.

Without the fix, the new test failed with the following runtime error:

```
TypeError: Cannot read properties of undefined (reading 'children')
  1003 |       let value = chunk.value;
  1004 |       for (let i = 1; i < path.length; i++) {
> 1005 |         value = value[path[i]];
       |                          ^
  1006 |       }
  1007 |       const chunkValue = map(response, value);
  1008 |       if (__DEV__ && chunk._debugInfo) {

  at getOutlinedModel (packages/react-client/src/ReactFlightClient.js:1005:26)
```

The bug was uncovered after updating React in Next.js in
https://github.com/vercel/next.js/pull/66711.
2024-07-24 19:34:41 -04:00
Sebastian Markbåge
933b737f64 Use brackets instead of parenthesis in empty name eval (#30449)
Otherwise V8 will parse it as a URL and mess it up. The bracket is a
magic string meaning empty.
2024-07-24 17:45:22 -04:00
Lauren Tan
a6b7e438ca [compiler] Correctly insert (Arrow)FunctionExpressions
Previously we would insert new (Arrow)FunctionExpressions as a sibling
of the original function. However this would break in the outlining case
as it would cause the original function expression's parent to become a
SequenceExpression, breaking a bunch of assumptions in the babel plugin.

To get around this, we synthesize a new VariableDeclaration to contain
the newly inserted function expression and therefore insert it as a true
sibling to the original function.

Yeah, it's kinda gross

ghstack-source-id: df13e3b439
Pull Request resolved: https://github.com/facebook/react/pull/30446
2024-07-24 16:02:29 -04:00
Lauren Tan
91e4f0712e [compiler] Repro for outlining bug in funcexprs
I discovered this compiler crash while trying to do an internal sync of
the compiler. Any kind of outlining appears to crash the babel plugin
when the component is a function expression.

ghstack-source-id: 4f717674af
Pull Request resolved: https://github.com/facebook/react/pull/30443
2024-07-24 16:02:28 -04:00
Sebastian Silbermann
c0b76a6831 [Flight] Allow parens in filenames when parsing stackframes (#30396) 2024-07-24 20:02:20 +02:00
Sebastian Markbåge
5b37af7daa Stop filtering owner stacks (#30438)
We still filter them before passing from server to client in Flight
Server but when presenting a native stack, we don't need to filter them.
That's left to ignore listing in the presentation.

The stacks are pretty clean regardless thanks to the bottom stack
frames.

We can also unify the owner stack formatters into one shared module
since Fizz/Flight/Fiber all do the same thing. DevTools currently does
the same thing but is forked so it can support multiple versions.
2024-07-24 13:01:07 -04:00
Jan Kassens
ab2135c708 [BE] enable prettier for flow fixtures (#30426)
Since switching to `hermes-parser`, we can parse all flow syntax and no
longer need to exclude these fixtures from prettier.
2024-07-24 10:59:40 -04:00