Commit Graph

19979 Commits

Author SHA1 Message Date
Sebastian "Sebbie" Silbermann
c6a7e18636 Ensure captureOwnerStack returns null when no stack is available (#32353)
Co-authored-by: Younes Henni <youneshenniwrites@gmail.com>
2025-02-13 18:09:49 +01:00
LoganDark
cbbe8666a8 fix value formatting of proxies of class instances (#30880)
For Hookstate Proxies of class instances, `data.constructor.name`
returns `Proxy({})`, so use
`Object.getPrototypeOf(data).constructor.name` instead, which works
correctly from my testing.

<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

React DevTools immediately bricks itself if you inspect any component
that has a prop that is a Hookstate that wraps a class instance ...
because these are proxies where `data.constructor.name` returns some
un-cloneable object, but `Object.getPrototypeOf(data)` doesn't return
`Object` (it returns the prototype of the class inside).

## How did you test this change?

This part of the code has no associated tests at all.

Technically,
`packages/react-devtools-shared/src/__tests__/legacy/inspectElement-test.js`
exists, but I tried `yarn test` and these tests aren't even executed
anymore. I can't figure it out, so whatever.

If you run this code:

```js
    class Class {}
    const instance = new Class();

    const instanceProxy = new Proxy(instance, {
      get(target, key, receiver) {
        if (key === 'constructor') {
          return { name: new Proxy({}, {}) };
        }

        return Reflect.get(target, key, receiver);
      },
    });
```

then `instanceProxy.constructor.name` returns some proxy that cannot be
cloned, but `Object.getPrototypeOf(instanceProxy).constructor.name`
returns the correct value.

This PR fixes the devtools to use
`Object.getPrototypeOf(instanceProxy).constructor.name`.

I modified my local copy of devtools to use this method and it fixed the
bricking that I experienced.

Related #29954
2025-02-13 12:04:53 +00:00
François Best
e0131f1eda fix(devtools): Handle nullish values passed to formatConsoleArguments (#32372)
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

<!--
Explain the **motivation** for making this change. What existing problem
does the pull request solve?
-->

When using React Devtools, calling `console.log('%s', null)` in userland
can cause it to throw an error:

```
TypeError: Cannot read properties of null (reading 'toString')
```

## How did you test this change?

Added a unit test.

<!--
Demonstrate the code is solid. Example: The exact commands you ran and
their output, screenshots / videos if the pull request changes the user
interface.
How exactly did you verify that your PR solves the issue you wanted to
solve?
  If you leave this empty, your PR will very likely be closed.
-->

See https://github.com/47ng/nuqs/issues/808.
2025-02-13 12:02:55 +00:00
lauren
5a78dd7cfe [ci] Also notify compiler ready for review PRs (#32371)
Similar to #32344
2025-02-12 15:13:47 -05:00
lauren
d814852baf [compiler] Upgrade esbuild (#32368)
Just a simple upgrade
2025-02-12 11:59:56 -05:00
Rubén Norte
f83903bfcc [RN] Set up test to create public instances lazily in Fabric (#32363)
## Summary

In React Native, public instances and internal host nodes are not
represented by the same object (ReactNativeElement & shadow nodes vs.
just DOM elements), and the only one that's required for rendering is
the shadow node. Public instances are generally only necessary when
accessed via refs or events, and that usually happens for a small amount
of components in the tree.

This implements an optimization to create the public instance on demand,
instead of eagerly creating it when creating the host node. We expect
this to improve performance by reducing the logic we do per node and the
number of object allocations.

## How did you test this change?

Manually synced the changes to React Native and run Fantom tests and
benchmarks, with the flag enabled and disabled. All tests pass in both
cases, and benchmarks show a slight but consistent performance
improvement.
2025-02-12 13:52:57 +00:00
Josh Goldberg ✨
192555bb0e Added dev-only warning for null/undefined create in use*Effect (#32355)
## Summary

Fixes #32354.

Re-creation of #15197: adds a dev-only warning if `create == null` to
the three `use*Effect` functions:

* `useEffect`
* `useInsertionEffect`
* `useLayoutEffect`

Updates the warning to match the same text given in the
`react/exhaustive-deps` lint rule.

## How did you test this change?

I applied the changes manually within `node_modules/` on a local clone
of
https://github.com/JoshuaKGoldberg/repros/tree/react-use-effect-no-arguments.

Please pardon me for opening a PR addressing a not-accepted issue. I was
excited to get back to #15194 -> #15197 now that I have time. 🙂

---------

Co-authored-by: lauren <poteto@users.noreply.github.com>
2025-02-11 17:01:04 -05:00
lauren
a69b80d07e [crud] Remove useResourceEffect (#32206)
Removes useResourceEffect.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32206).
* __->__ #32206
* #32205
2025-02-11 14:19:34 -05:00
lauren
2c5fd26c07 [crud] Merge useResourceEffect into useEffect (#32205)
Merges the useResourceEffect API into useEffect while keeping the
underlying implementation the same. useResourceEffect will be removed in
the next diff.

To fork between behavior we rely on a `typeof` check for the updater or
destroy function in addition to the CRUD feature flag. This does now
have to be checked every time (instead of inlined statically like before
due to them being different hooks) which will incur some non-zero amount
(possibly negligble) of overhead for every effect.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32205).
* #32206
* __->__ #32205
2025-02-11 14:18:50 -05:00
lauren
0461c0d8a4 [crud] Rename useResourceEffect flag (#32204)
Rename the flag in preparation for the overload.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32204).
* #32206
* #32205
* __->__ #32204
2025-02-11 14:05:50 -05:00
lauren
899e3d1297 [crud] Narrow resource type (#32203)
Small refactor to the `resource` type to narrow it to an arbitrary
object or void/null instead of the top type. This makes the overload on
useEffect simpler since the return type of create is no longer widened
to the top type when we merge their definitions.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32203).
* #32206
* #32205
* #32204
* __->__ #32203
2025-02-11 13:52:25 -05:00
Brendan Abbott
0a7dc1b1c7 [devtools] Introduce REACT_DEVTOOLS_PORT for the standalone react-devtools (#30767)
## Summary

This PR attempts to make running the React DevTools a little friendlier
in projects that are not completely React.

At the moment, running the DevTools with `npx react-devtools` will
default to the port to use the `PORT` env variable otherwise it'll fall
back to `8097`. `PORT` is a common env variable, so we can get into this
strange situation where the a Rails server (eg Puma) is using `PORT`,
and then the React DevTools attempts to boot using the same `PORT`.

This PR introduces a dedicated env variable, `REACT_DEVTOOLS_PORT` to
assist in this scenario.

## How did you test this change?

I'm using fish shell, so I did the following, please let me know if
there's a better way:

```sh
cd packages/react-devtools
set -x PORT 1000
set -x REACT_DEVTOOLS_PORT 2000
node bin.js
```

We can see in the UI that it's listening on `2000`. Without this PR,
it'd listen on `1000`:

![Screenshot 2024-08-21 at 10 45
42 AM](https://github.com/user-attachments/assets/a5c7590c-1b54-4ac8-9a8b-8eb66ff67cfb)
2025-02-11 18:14:43 +00:00
lauren
cd90a4d8c0 [react-native] Suppress Flow nonstrict-import check in ReactNativeTypes (#32349)
Summary: Unblock internal sync.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
2025-02-10 15:46:47 -05:00
lauren
3dd2c62770 [react-native] fix divergence in synced code (#32348)
Alternative to #32334
2025-02-10 14:08:44 -05:00
Hendrik Liebau
93b58361d9 Trigger Discord notification when draft PR is set to "ready for review" (#32344)
Follow-up for #32332. The Discord webhook seems to ignore draft PRs,
which is a good thing. But when a draft PR is then later set to "ready
for review" we do want to send another notification that should not be
filtered out.
2025-02-09 17:55:50 -05:00
Sebastian Markbåge
594ea533d3 Remove useActionState Hook export from experimental react-server condition (#32342)
This Hook is not available in RSC environments. This is already the case
in stable but not in experimental for some reason. Probably an
oversight.
2025-02-09 15:01:28 -05:00
lauren
062fb31155 [ci] Fix typo (#32337)
Oops.
2025-02-07 18:01:53 -05:00
lauren
7588b6b291 [ci] Disallow PRs against builds branch (#32335)
Our internal build infra relies on a 1:1 mapping between `main` and the
2 build branches. Directly committing changes to those branches breaks
that infra.

Adds a simple workflow to leave a comment and decline the PR.
2025-02-07 17:49:09 -05:00
lauren
569c3b28ee [ci] Combine sizebot jobs (#32333)
There's no real reason to have 2 jobs for sizebot. It's more of a
historical artifact from before the GH migration. Merging them should
require one less worker needing to be provisioned and some of the extra
overhead
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32333).
* __->__ #32333
* #32332
2025-02-07 16:39:37 -05:00
lauren
bc78de3a52 [ci] Use 'opened' event for discord notifications (#32332)
We don't need to wait for it to be labeled now that we have the shared
maintainer check workflow.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32332).
* #32333
* __->__ #32332
2025-02-07 16:34:26 -05:00
lauren
989b0cccc2 [compiler] Add simple walltime measurement (#32331)
Adds a new Timing logger event to the compiler which currently only
records the walltime of running the compiler from the time the babel
plugin's Program visitor enters to the time it exits.

To enable, run the compiler with `ENABLE_REACT_COMPILER_TIMINGS=1 ...`
or `export ENABLE_REACT_COMPILER_TIMINGS=1` to set it by default.
2025-02-07 16:04:46 -05:00
inottn
76e44c2911 [compiler] Improve error messages for unhandled terminal and instruction kinds (#32324)
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

<!--
Explain the **motivation** for making this change. What existing problem
does the pull request solve?
-->
Improve the error message, as the value is currently an object instead
of a string, which results in it being converted to '[object Object]'.

## How did you test this change?
Already tested locally.
<!--
Demonstrate the code is solid. Example: The exact commands you ran and
their output, screenshots / videos if the pull request changes the user
interface.
How exactly did you verify that your PR solves the issue you wanted to
solve?
  If you leave this empty, your PR will very likely be closed.
-->
2025-02-07 15:48:03 -05:00
Jack Pope
8759c5c8d6 Ship enableFabricCompleteRootInCommitPhase (#32318) 2025-02-07 11:12:29 -05:00
Ruslan Lesiutin
44c3d3d665 fix[react-devtools-standalone]: define missing globals (#32327)
Same as what we did for `react-devtools-fusebox` in
https://github.com/facebook/react/pull/32297.
2025-02-07 11:07:46 +00:00
Ruslan Lesiutin
ae3190c5e9 React DevTools 6.1.0 -> 6.1.1 (#32326)
Full list of changes:
* DevTools: refactor NativeStyleEditor, don't use custom cache
implementation ([hoxyq](https://github.com/hoxyq) in
[#32298](https://github.com/facebook/react/pull/32298))
* fix[react-devtools-fusebox]: add extension globals to build
([hoxyq](https://github.com/hoxyq) in
[#32297](https://github.com/facebook/react/pull/32297))
* DevTools: fix host component filter option title
([hoxyq](https://github.com/hoxyq) in
[#32296](https://github.com/facebook/react/pull/32296))
* chore[DevTools]: make clipboardWrite optional for chromium
([hoxyq](https://github.com/hoxyq) in
[#32262](https://github.com/facebook/react/pull/32262))
* DevTools: support useEffectEvent and forward-fix experimental prefix
support ([hoxyq](https://github.com/hoxyq) in
[#32106](https://github.com/facebook/react/pull/32106))
2025-02-07 10:54:44 +00:00
Josh Story
a0fdb63060 [Fiber][Dev] Relax dom nesting validation when the root is a Document, html tag, or body tag (#32252)
followup to
* https://github.com/facebook/react/pull/32069
* https://github.com/facebook/react/pull/32163
* https://github.com/facebook/react/pull/32224

in react-dom in Dev we validate that the tag nesting is valid. This is
motivated primarily because while browsers are tolerant to poor HTML
there are many cases that if server rendered will be hydrated in a way
that will break hydration.

With the changes to singleton scoping where the document body is now the
implicit render/hydration context for arbitrary tags at the root we need
to adjust the validation logic to allow for valid programs such as
rendering divs as a child of a Document (since this div will actually
insert into the body).
2025-02-06 15:05:51 -08:00
Josh Story
b48e739998 [Fiber] getHoistableRoot() should account for Document containers (#32321)
While modern DOM implementations all support getRootNode if you are
running React in a runtime which does not the fallback logic which uses
`.ownerDocument` works everywhere except when the container is a
Document itself. This change corrects this by returning the container
intsance if it is a Document type.
2025-02-06 14:30:41 -08:00
Ricky
ff6283340a Export addTransitionType for www (#32311)
need dis based api
2025-02-05 18:31:32 -05:00
Ruslan Lesiutin
d85cf3e5ab DevTools: refactor NativeStyleEditor, don't use custom cache implementation (#32298)
We have this really old (5+ years) feature for inspecting native styles
of React Native Host components.

We also have a custom Cache implementation in React DevTools, which was
forked from React at some point. We know that this should be removed,
but it spans through critical parts of the application, like fetching
and caching inspected element.

Before this PR, this was also used for caching native style and layouts
of RN Host components. This approach is out of date, and was based on
the presence of Suspense boundary around inspected element View, which
we have removed to speed up element inspection -
https://github.com/facebook/react/pull/30555.
 
Looks like I've introduced a regression in
https://github.com/facebook/react/pull/31956:
- Custom Cache implementation will throw thenables and suspend.
- Because of this, some descendant Suspense boundaries will not resolve
for a long time, and React will throw an error
https://react.dev/errors/482.

I've switched from a usage of this custom Cache implementation to a
naive fetching in effect and keeping the layout and style in a local
state of a Context, which will be propagated downwards. The race should
be impossible, this is guaranteed by the mechanism for queueing messages
through microtasks queue.

The only downside is the UI. If you quickly switch between 2 elements,
and one of them has native style, while the other doesn't, UI will feel
jumpy. We can address this later with a Suspense boundary, if needed.
2025-02-05 12:52:48 +00:00
Jack Pope
32b411496b Set enableViewTransition to dynamic for www (#32306)
Unblocks internal experimentation
2025-02-04 15:53:03 -05:00
Josh Story
0605cd9f38 [Fiber] Disable comments as containers in OSS (#32250)
3 years ago we partially disabled comment nodes as valid containers.
Some unflagged support was left in due to legacy APIs like
`unmountComponentAtNode` and `unstable_renderSubtreeIntoContainer` but
these were since removed in React 19. This update flags the remaining
uses of comments as containers.
2025-02-04 12:39:52 -08:00
Josh Story
8bda71558c [Fiber] support hydration when rendering Suspense anywhere (#32224)
follow up to https://github.com/facebook/react/pull/32163

This continues the work of making Suspense workable anywhere in a
react-dom tree. See the prior PRs for how we handle server rendering and
client rendering. In this change we update the hydration implementation
to be able to locate expected nodes. In particular this means hydration
understands now that the default hydration context is the document body
when the container is above the body.

One case that is unique to hydration is clearing Suspense boundaries.
When hydration fails or when the server instructs the client to recover
an errored boundary it's possible that the html, head, and body tags in
the initial document were written from a fallback or a different primary
content on the server and need to be replaced by the client render.
However these tags (and in the case of head, their content) won't be
inside the comment nodes that identify the bounds of the Suspense
boundary. And when client rendering you may not even render the same
singletons that were server rendered. So when server rendering a
boudnary which contributes to the preamble (the html, head, and body tag
openings plus the head contents) we emit a special marker comment just
before closing the boundary out. This marker encodes which parts of the
preamble this boundary owned. If we need to clear the suspense boundary
on the client we read this marker and use it to reset the appropriate
singleton state.
2025-02-04 12:30:30 -08:00
Devon Govett
f82c662b8d [Flight Parcel] Implement findSourceMapURL (#32294)
This implements `findSourceMapURL` in react-server-dom-parcel, enabling
source maps for replayed server errors on the client. It utilizes a new
endpoint in the Parcel dev server that returns the source map for a
given bundle/file. The error overlay UI has also been updated to handle
these stacks. See https://github.com/parcel-bundler/parcel/pull/10082

Also updated the fixture to the latest Parcel canary. A few APIs have
changed. We do have a higher level library wrapper now (`@parcel/rsc`
added in https://github.com/parcel-bundler/parcel/pull/10074) but I left
the fixture using the lower level APIs directly here since it is easier
to see how react-server-dom-parcel is used.
2025-02-04 14:17:13 -05:00
lauren
0a82580bfc [ci] Only notify discord on core team label (#32303)
Rather than notify on every label event on a PR by a core team member,
only do so for the specific core team label event.
2025-02-03 12:57:51 -05:00
michael faith
442150e0e2 build(eslint-plugin-react-hooks): tsconfig and global types (#32283)
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

Contributing to https://github.com/facebook/react/pull/32240, this
change adds the tsconfig, tsup config, and estree type declarations that
will be needed for that plugin's typescript migration.
2025-02-03 12:07:30 -05:00
inottn
10a4c88f58 [compiler] Handle TSInstantiationExpression in lowerExpression (#32302)
Fix #31745
2025-02-03 08:41:04 -08:00
Ruslan Lesiutin
a4b2d0d518 fix[react-devtools-fusebox]: add extension globals to build (#32297)
We started using these globals in `react-devtools-shared/src/frontend`
code, forward-fixing https://github.com/facebook/react/pull/32262.
2025-02-03 09:59:58 +00:00
Ruslan Lesiutin
1f0b03ced0 DevTools: fix host component filter option title (#32296)
Overlook that in https://github.com/facebook/react/pull/32086, because
of ternany, it is already string literals, so html entities names no
longer needed.
2025-02-03 09:59:47 +00:00
mofeiZ
152bfe3769 [compiler][rfc] Hacky retry pipeline for fire (#32164)
Hacky retry pipeline for when transforming `fire(...)` calls encounters
validation, todo, or memoization invariant bailouts. Would love feedback
on how we implement this to be extensible to other compiler
non-memoization features (e.g. inlineJSX)

Some observations:
- Compiler "front-end" passes (e.g. lower, type, effect, and mutability
inferences) should be shared for all compiler features -- memo and
otherwise
- Many passes (anything dealing with reactive scope ranges, scope blocks
/ dependencies, and optimizations such as ReactiveIR #31974) can be left
out of the retry pipeline. This PR hackily skips memoization features by
removing reactive scope creation, but we probably should restructure the
pipeline to skip these entirely on a retry
- We should maintain a canonical set of "validation flags"

Note the newly added fixtures are prefixed with `bailout-...` when the
retry fire pipeline is used. These fixture outputs contain correctly
inserted `useFire` calls and no memoization.
2025-01-31 15:57:26 -08:00
Wick
19ca800caa Reconciler: Combine identical cases in findParent (#32210)
## Summary

When lookup `Parent`, `HostRoot` and `HostPortal` should be merged,
because when creating a `Portal`, it will also include
`containerInfo`(So we can directly use this `containerInfo` to delete
the real DOM nodes.), so there is no need to handle them separately.

## How did you test this change?

No behavior changes, all existing tests pass.
2025-01-31 14:35:48 -08:00
michael faith
a657bc5dee build(eslint-plugin-react-hooks): add dev dependencies for typescript migration (#32279)
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

Contributing to https://github.com/facebook/react/pull/32240, this
change adds the dev dependencies needed to support the migration of the
plugin to typescript.
2025-01-31 14:32:23 -05:00
Timothy Yung
9ff42a8798 Permit non-DEV Elements in React.Children w/ DEV (#32117) 2025-01-30 22:59:45 -08:00
David Michael Gregg
87c03a0a13 Fix typo in dangerfile.js which results in an unreachable code path… (#32277)
## Summary

Fix typo in dangerfile.js which results in an unreachable code path
which ought to be hit when there is no matching base artifact during
DangerCI automated code review.

See:
221f3002ca/dangerfile.js (L73)
Compare:
221f3002ca/dangerfile.js (L171)
And the case which should hit this code path:
221f3002ca/dangerfile.js (L160)

Given the above context, the condition `Number === Infinity` is clearly
meant to be `decimal === Infinity`, which it will be if the `catch`
statement triggers when there is no matching base artifact. Without this
fix, the primitive value `Infinity` is passed to
`percentFormatter.format(decimal)`, resulting in the string `'+∞%'`.
With this fix, the resulting string will be the intended `'New file'`.

## [Resolves issue
32278](https://github.com/facebook/react/issues/32278)
2025-01-31 01:44:02 -05:00
Ruslan Lesiutin
221f3002ca chore[DevTools]: make clipboardWrite optional for chromium (#32262)
Addresses https://github.com/facebook/react/issues/32244.

### Chromium
We will use
[chrome.permissions](https://developer.chrome.com/docs/extensions/reference/api/permissions)
for checking / requesting `clipboardWrite` permission before copying
something to the clipboard.

### Firefox
We will keep `clipboardWrite` as a required permission, because there is
no reliable and working API for requesting optional permissions for
extensions that are extending browser DevTools:
- `chrome.permissions` is unavailable for devtools pages -
https://bugzilla.mozilla.org/show_bug.cgi?id=1796933
- You can't call `chrome.permissions.request` from background, because
this instruction has to be executed inside user-event callback,
basically only initiated by user.

I don't really want to come up with solutions like opening a new tab
with a button that user has to click.
2025-01-30 20:08:17 +00:00
lauren
55b54b0d63 [ci] Only install chromium for flight fixtures (#32275)
I noticed we only use chromium in fixtures/flight, so let's specifically
only install that browser in ci.
2025-01-30 14:13:45 -05:00
Sebastian Markbåge
4b3728f05e [Fiber] Track Appearing Named ViewTransition in the accumulateSuspenseyCommit Phase (#32254)
When a named ViewTransition component unmounts in one place and mounts
in a different place we need to match these up so we know a pair has
been created. Since the unmounts are tracked in the snapshot phase we
need some way to track the mounts before that.

Originally the way I did that is by reusing the render phase since there
was no other phase in the commit before that. However, that's not quite
correct. Just because something is visited in render doesn't mean it'll
commit. E.g. if that tree ends up suspending or erroring. Which would
lead to a false positive on match. The unmount shouldn't animate in that
case.

(Un)fortunately we have already added a traversal before the snapshot
phase for tracking suspensey CSS. The `accumulateSuspenseyCommit` phase.
This needs to find new mounts of Suspensey CSS or if there was a
reappearing Offscreen boundary it needs to find any Suspensey CSS
already inside that tree. This is exactly the same traversal we need to
find newly appearing View Transition components. So we can just reuse
that.
2025-01-30 12:13:36 -05:00
lauren
f02ba2fcc5 [ci] Remove build_devtools_and_process_artifacts as a dependency to run_devtools_e2e_tests (#32267)
I just noticed that we don't actually need to let the devtools build
finish first because the e2e tests don't use those built files. We can
decouple them to allow them to run in paralllel.
2025-01-30 11:55:28 -05:00
lauren
14f7c07271 [ci] Try to parallelize devtools builds (#32266)
Building DevTools is currently the long pole for the runtime CI job.
Let's see if we can get the overall runtime for runtime build and test
down by speeding this one step up.
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32266).
* #32267
* __->__ #32266
2025-01-30 11:49:04 -05:00
Sebastian Markbåge
2fe5b572bc [Fiber] Read the class name from props.layout (#32273)
Copypasta typo.
2025-01-30 11:46:43 -05:00
Dmytro Rykun
bb9a24d9fc Use fastAddProperties in diffing (#32243)
## Summary

`fastAddProperties` has shown some perf benefits when used for creating
props payload for new components. In this PR we'll try to use it for
diffing props for existing components.

It would be good enough if it simply doesn't regress perf. We'll be able
to delete the old `addProperties`, and make `fastAddProperties` the
default behaviour.

## How did you test this change?

```
yarn lint
yarn flow native
yarn test packages/react-native-renderer -r=xplat --variant=false
yarn test packages/react-native-renderer -r=xplat --variant=true
```
2025-01-30 11:16:42 +00:00