Commit Graph

73 Commits

Author SHA1 Message Date
kassens 269610e2da [www] set enableTrustedTypesIntegration to false (#25997)
This isn't configured to a dynamic value on www, so hardcode here to
false.

DiffTrain build for [379dd741e9](https://github.com/facebook/react/commit/379dd741e9aabefb880af1794d3c828984f9e143)
[View git log for this commit](https://github.com/facebook/react/commits/379dd741e9aabefb880af1794d3c828984f9e143)
2023-01-13 21:09:15 +00:00
alunyov 7a7a09e56a [cleanup] Remove warnAboutDeprecatedLifecycles feature flag (#25992)
This `warnAboutDeprecatedLifecycles` is always true, and should be safe
to remove.

DiffTrain build for [489d00fa61](https://github.com/facebook/react/commit/489d00fa61dd3c406b1c053a7a039d97f7fe213f)
[View git log for this commit](https://github.com/facebook/react/commits/489d00fa61dd3c406b1c053a7a039d97f7fe213f)
2023-01-12 22:06:06 +00:00
eps1lon 8a139482d4 Don't warn about concurrently rendering contexts if we finished rendering (#22797)
Closes https://github.com/facebook/react/issues/22796

DiffTrain build for [555ece0cd1](https://github.com/facebook/react/commit/555ece0cd14779abd5a1fc50f71625f9ada42bef)
[View git log for this commit](https://github.com/facebook/react/commits/555ece0cd14779abd5a1fc50f71625f9ada42bef)
2023-01-12 12:26:00 +00:00
kassens 6a673aad3f [cleanup] remove feature flags warnAboutDefaultPropsOnFunctionComponents and warnAboutStringRefs (#25980)
These feature flags are fully rolled out and easy to clean up. Let's
remove them!

DiffTrain build for [0fce6bb498](https://github.com/facebook/react/commit/0fce6bb498357feb4465859912004b2e20fe7084)
[View git log for this commit](https://github.com/facebook/react/commits/0fce6bb498357feb4465859912004b2e20fe7084)
2023-01-11 17:26:46 +00:00
kassens 84aa038656 [cleanup] remove unused values from ReactFeatureFlags.www-dynamic (#25575)
These values are never imported into `ReactFeatureFlags.www.js`, so
they're unused:
- `allowConcurrentByDefault`
- `consoleManagedByDevToolsDuringStrictMode`

These values are never set in the WWW module
(https://fburl.com/code/dsb2ohv8), so they're always `undefined` on www:
- `createRootStrictEffectsByDefault`
- `enableClientRenderFallbackOnTextMismatch`

DiffTrain build for [7002a6743e](https://github.com/facebook/react/commit/7002a6743ebb24ed55af8f626c89dd39460230fc)
[View git log for this commit](https://github.com/facebook/react/commits/7002a6743ebb24ed55af8f626c89dd39460230fc)
2023-01-11 04:33:02 +00:00
tyao1 198e9a468e Test case for stack overflow in ReactFizzServer (#25971)
SSR currently stack overflows when the component tree is extremely large

DiffTrain build for [fb324faf8a](https://github.com/facebook/react/commit/fb324faf8a3da08212bcc5ea9e3a084dbfa80dad)
[View git log for this commit](https://github.com/facebook/react/commits/fb324faf8a3da08212bcc5ea9e3a084dbfa80dad)
2023-01-11 01:00:15 +00:00
kassens 2950351269 [cleanup] remove old feature flag warnAboutDeprecatedLifecycles (#25978)
This feature flag was always set to true, we can easily clean it up.

DiffTrain build for [a48e54f2b7](https://github.com/facebook/react/commit/a48e54f2b74d87d90b0a3bff3a9b52fd9188308b)
[View git log for this commit](https://github.com/facebook/react/commits/a48e54f2b74d87d90b0a3bff3a9b52fd9188308b)
2023-01-10 20:38:56 +00:00
kassens 43941d2706 Remove duplicate JSResourceReferenceImpl mock (#25976)
This mock exists in 2 directories (with identical implementation) and
Jest just picks one at random. This removes one which makes it at least
deterministic and fixes a Jest warning on startup.

It existed in these 2 places:
-
`packages/react-server-dom-relay/src/__mocks__/JSResourceReferenceImpl.js`
-
`packages/react-server-native-relay/src/__mocks__/JSResourceReferenceImpl.js`
(removed)

DiffTrain build for [0f4a835966](https://github.com/facebook/react/commit/0f4a83596646c610c06b751fc8ac0fc51f90d796)
[View git log for this commit](https://github.com/facebook/react/commits/0f4a83596646c610c06b751fc8ac0fc51f90d796)
2023-01-10 15:41:00 +00:00
kassens e21231305d Remove unused Flow suppressions (#25977)
These suppressions are no longer required.

Generated using:
```sh
flow/tool update-suppressions .
```
followed by adding back 1 or 2 suppressions that were only triggered in
some configurations.

DiffTrain build for [c49131669b](https://github.com/facebook/react/commit/c49131669ba23500b8b071a5ca6ef189a28aa83e)
[View git log for this commit](https://github.com/facebook/react/commits/c49131669ba23500b8b071a5ca6ef189a28aa83e)
2023-01-10 15:40:37 +00:00
kassens db4353c6b9 Refactor: remove useless parameter (#25923)
## Summary

I was reading the source code of `ReactFiberLane.js` and I found the
third parameter of the function markRootPinged was not used. So I think
we can remove it.

## How did you test this change?

There is no logic changed, so I think there is no need to add unit
tests. So I run `yarn test` and `yarn test --prod` locally and all tests
are passed.

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

DiffTrain build for [afe6521e13](https://github.com/facebook/react/commit/afe6521e134178920f0523ede4c715942d8f0564)
[View git log for this commit](https://github.com/facebook/react/commits/afe6521e134178920f0523ede4c715942d8f0564)
2023-01-10 04:31:50 +00:00
kassens 6283e193a9 Refactor: Reuse variable "remoteRepoDir" (#25740)
Reuse variable `remoteRepoDir` , same with `join(__dirname, 'remote-repo')`.

DiffTrain build for [1253462ea4](https://github.com/facebook/react/commit/1253462ea48db362faad864695a172f5a56759ca)
[View git log for this commit](https://github.com/facebook/react/commits/1253462ea48db362faad864695a172f5a56759ca)
2023-01-10 04:07:44 +00:00
kassens 626122450f Upgrade to Flow 0.196.3 (#25974)
After the previous changes these upgrade are easy.

- removes config options that were removed
- object index access now requires an indexer key in the type, this
cause a handful of errors that were fixed
- undefined keys error in all places, this needed a few extra
suppressions for repeated undefined identifiers.

Flow's
[CHANGELOG.md](https://github.com/facebook/flow/blob/main/Changelog.md).

DiffTrain build for [34464fb16c](https://github.com/facebook/react/commit/34464fb16c2aec8202dab868eb381da0e807d771)
[View git log for this commit](https://github.com/facebook/react/commits/34464fb16c2aec8202dab868eb381da0e807d771)
2023-01-09 23:00:43 +00:00
kassens 7fdc64c23d [flow] enable exact_empty_objects (#25973)
This enables the "exact_empty_objects" setting for Flow which makes
empty objects exact instead of building up the type as properties are
added in code below. This is in preparation to Flow 191 which makes this
the default and removes the config.

More about the change in the Flow blog
[here](https://medium.com/flow-type/improved-handling-of-the-empty-object-in-flow-ead91887e40c).

DiffTrain build for [e2424f33b3](https://github.com/facebook/react/commit/e2424f33b3ad727321fc12e75c5e94838e84c2b5)
[View git log for this commit](https://github.com/facebook/react/commits/e2424f33b3ad727321fc12e75c5e94838e84c2b5)
2023-01-09 22:09:08 +00:00
kassens 30755244ec [flow] enable enforce_local_inference_annotations (#25921)
This setting is an incremental path to the next Flow version enforcing
type annotations on most functions (except some inline callbacks).

Used
```
node_modules/.bin/flow codemod annotate-functions-and-classes --write .
```
to add a majority of the types with some hand cleanup when for large
inferred objects that should just be `Fiber` or weird constructs
including `any`.

Suppressed the remaining issues.

Builds on #25918

DiffTrain build for [0b4f443020](https://github.com/facebook/react/commit/0b4f443020af386f2b48c47c074cb504ed672dc8)
[View git log for this commit](https://github.com/facebook/react/commits/0b4f443020af386f2b48c47c074cb504ed672dc8)
2023-01-09 20:54:59 +00:00
mofeiZ 31317708b8 [Fizz] Fork Fizz instruction set for inline script and external runtime (#25862)
~~[Fizz] Duplicate completeBoundaryWithStyles to not reference globals~~

## Summary

Follow-up / cleanup PR to #25437

- `completeBoundaryWithStylesInlineLocals` is used by the Fizz external
runtime, which bundles together all Fizz instruction functions (and is
able to reference / rename `completeBoundary` and `resourceMap` as
locals).
- `completeBoundaryWithStylesInlineGlobals` is used by the Fizz inline
script writer, which sends Fizz instruction functions on an as-needed
basis. This version needs to reference `completeBoundary($RC)` and
`resourceMap($RM)` as globals.

Ideally, Closure would take care of inlining a shared implementation,
but I couldn't figure out a zero-overhead inline due to lack of an
`@inline` compiler directive. It seems that Closure thinks that a shared
`completeBoundaryWithStyles` is too large and will always keep it as a
separate function. I've also tried currying / writing a higher order
function (`getCompleteBoundaryWithStyles`) with no luck

## How did you test this change?
- generated Fizz inline instructions should be unchanged
- bundle size for unstable_external_runtime should be slightly smaller
(due to lack of globals)
- `ReactDOMFizzServer-test.js` and `ReactDOMFloat-test.js` should be
unaffected

DiffTrain build for [0b974418c9](https://github.com/facebook/react/commit/0b974418c9a56f6c560298560265dcf4b65784bc)
[View git log for this commit](https://github.com/facebook/react/commits/0b974418c9a56f6c560298560265dcf4b65784bc)
2023-01-06 19:35:53 +00:00
tyao1 9f85d072fb Batch sync, default and continuous lanes (#25700)
<!--
  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 debug-test --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?
-->
This is the other approach for unifying default and sync lane
https://github.com/facebook/react/pull/25524.
The approach in that PR is to merge default and continuous lane into the
sync lane, and use a new field to track the priority. But there are a
couple places that field will be needed, and it is difficult to
correctly reset the field when there is no sync lane.

In this PR we take the other approach that doesn't remove any lane, but
batch them to get the behavior we want.

## How did you test this change?

<!--
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.
-->
yarn test

Co-authored-by: Andrew Clark <hi@andrewclark.io>

DiffTrain build for [5379b6123f](https://github.com/facebook/react/commit/5379b6123f171bb48cc8a9c435c11ccb9f8ff0e7)
[View git log for this commit](https://github.com/facebook/react/commits/5379b6123f171bb48cc8a9c435c11ccb9f8ff0e7)
2023-01-05 23:28:33 +00:00
kassens f7173f143a Transform updates to support Flow this annotation syntax (#25918)
Flow introduced a new syntax to annotated the context type of a
function, this tries to update the rest and add 1 example usage.

- 2b1fb91a55 already added the changes
required for eslint.
- Jest transform is updated to use the recommended `hermes-parser` which
can parse current and Flow syntax and will be updated in the future.
- Rollup uses a new plugin to strip the flow types. This isn't ideal as
the npm module is deprecated in favor of using `hermes-parser`, but I
couldn't figure out how to integrate that with Rollup.

DiffTrain build for [b83baf63f7](https://github.com/facebook/react/commit/b83baf63f71669ca7bf222afec305b7a6fd782b7)
[View git log for this commit](https://github.com/facebook/react/commits/b83baf63f71669ca7bf222afec305b7a6fd782b7)
2023-01-05 20:50:52 +00:00
kassens 3d02074c9a fix function type for flow (#25965)
These files fail CI `yarn_flow`.

DiffTrain build for [2619886ac0](https://github.com/facebook/react/commit/2619886ac0f1d41c9b361d82f069f9ed682321ff)
[View git log for this commit](https://github.com/facebook/react/commits/2619886ac0f1d41c9b361d82f069f9ed682321ff)
2023-01-05 20:35:47 +00:00
mondaychen 8059dfd9cc [DevTools] add perf regression test page in shell (#25078)
## Summary

This PR adds a "perf regression tests" page to react-devtools-shell.
This page is meant to be used as a performance sanity check we will run
whenever we release a new version or finish a major refactor.
Similar to other pages in the shell, this page can load the inline
version of devtools and a test react app on the same page. But this page
does not load devtools automatically like other pages. Instead, it
provides a button that allows us to load devtools on-demand, so that we
can easily compare perf numbers without devtools against the numbers
with devtools.

<img width="561" alt="image"
src="https://user-images.githubusercontent.com/1001890/184059633-e4f0852c-8464-4d94-8064-1684eee626f4.png">

As a first step, this page currently only contain one test:
mount/unmount a large subtree. This is to catch perf issues that
devtools can cause on the react applications it's running on, which was
once a bug fixed in #24863.
In the future, we plan to add:
- more test apps covering different scenarios
- perf numbers within devtools (e.g. initial load)

## How did you test this change?

In order to show this test app can actually catch the perf regression
it's aiming at, I reverted #24863 locally. Here is the result:

https://user-images.githubusercontent.com/1001890/184059214-9c9b308c-173b-4dd7-b815-46fbd7067073.mov

As shown in the video, the time it takes to unmount the large subtree
significantly increased after DevTools is loaded.

For comparison, here is how it looks like before the fix was reverted:
<img width="452" alt="image"
src="https://user-images.githubusercontent.com/1001890/184059743-0968bc7d-4ce4-42cd-b04a-f6cbc078d4f4.png">

## about the `requestAnimationFrame` method

For this test, I used `requestAnimationFrame` to catch the time when
render and commit are done. It aligns very well with the numbers
reported by Chrome DevTools performance profiling. For example, in one
run, the numbers reported by my method are
<img width="464" alt="image"
src="https://user-images.githubusercontent.com/1001890/184060228-990a4c75-f594-411a-9f85-fa5532ec8c37.png">
They are very close to the numbers reported by Chrome profiling:
<img width="456" alt="image"
src="https://user-images.githubusercontent.com/1001890/184060355-a15d1ec5-c296-4016-9c83-03e761f387e3.png">

<img width="354" alt="image"
src="https://user-images.githubusercontent.com/1001890/184060375-19029010-3aed-4a23-890e-397cdba86d9e.png">

`<Profiler>` is not able to catch this issue here.

If you are aware of a better way to do this, please kindly share with
me.

DiffTrain build for [ff9f943741](https://github.com/facebook/react/commit/ff9f943741671b6d83d732b2131d3f7e7d3c54c8)
[View git log for this commit](https://github.com/facebook/react/commits/ff9f943741671b6d83d732b2131d3f7e7d3c54c8)
2023-01-04 22:39:38 +00:00
acdlite 0e52cfcb52 Unify use and renderDidSuspendDelayIfPossible implementations (#25922)
When unwrapping a promise with `use`, we sometimes suspend the work loop
from rendering anything else until the data has resolved. This is
different from how Suspense works in the old throw-a-promise world,
where rather than suspend rendering midway through the render phase, we
prepare a fallback and block the commit at the end, if necessary;
however, the logic for determining whether it's OK to block is the same.
The implementation is only incidentally different because it happens in
two different parts of the code. This means for `use`, we end up doing
the same checks twice, which is wasteful in terms of computation, but
also introduces a risk that the logic will accidentally diverge.

This unifies the implementation by moving it into the SuspenseContext
module. Most of the logic for deciding whether to suspend is already
performed in the begin phase of SuspenseComponent, so it makes sense to
store that information on the stack rather than recompute it on demand.

The way I've chosen to model this is to track whether the work loop is
rendering inside the "shell" of the tree. The shell is defined as the
part of the tree that's visible in the current UI. Once we enter a new
Suspense boundary (or a hidden Offscreen boundary, which acts a Suspense
boundary), we're no longer in the shell. This is already how Suspense
behavior was modeled in terms of UX, so using this concept directly in
the implementation turns out to result in less code than before.

For the most part, this is purely an internal refactor, though it does
fix a bug in the `use` implementation related to nested Suspense
boundaries. I wouldn't be surprised if it happens to fix other bugs that
we haven't yet discovered, especially around Offscreen. I'll add more
tests as I think of them.

DiffTrain build for [c2d6552079](https://github.com/facebook/react/commit/c2d6552079178b36619f5dfd1ea39ae80b1d38b5)
[View git log for this commit](https://github.com/facebook/react/commits/c2d6552079178b36619f5dfd1ea39ae80b1d38b5)
2023-01-04 20:19:14 +00:00
acdlite f71e33397a Remove vestigial Suspense batching logic (#25861)
This code was originally added in the old ExpirationTime implementation
of Suspense. The idea is that if multiple updates suspend inside the
same Suspense boundary, and both of them resolve, we should render both
results in the same batch, to reduce jank.

This was an incomplete idea, though. We later discovered a stronger
requirement — once we show a fallback, we cannot fill in that fallback
without completing _all_ the updates that were previously skipped over.
Otherwise you get tearing. This was fixed by #18411, then we discovered
additional related flaws that were addressed in #24685. See those PR
descriptions for additional context.

So I believe this older code is no longer necessary.

DiffTrain build for [48274a43aa](https://github.com/facebook/react/commit/48274a43aa708f63a7580142a4c1c1a47f31c1ac)
[View git log for this commit](https://github.com/facebook/react/commits/48274a43aa708f63a7580142a4c1c1a47f31c1ac)
2023-01-04 19:57:07 +00:00
sebmarkbage f96c1b8c3a Add fetchPriority to <img> and <link> (#25927)
<!--
  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 debug-test --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

- Fixes https://github.com/facebook/react/issues/25682

## How did you test this change?

I tried this but it didn't work
```
yarn build --type=UMD_DEV react/index,react-dom && cd fixtures/attribute-behavior && yarn install && yarn start
```

Co-authored-by: eps1lon <silbermann.sebastian@gmail.com>

DiffTrain build for [de7d1c9071](https://github.com/facebook/react/commit/de7d1c90718ea8f4844a2219991f7115ef2bd2c5)
[View git log for this commit](https://github.com/facebook/react/commits/de7d1c90718ea8f4844a2219991f7115ef2bd2c5)
2022-12-23 19:39:21 +00:00
eps1lon f011917c95 reconciler docs: fix small typo - "mode" (instead of "node") (#25863)
DiffTrain build for [81d4ee9ca5](https://github.com/facebook/react/commit/81d4ee9ca5c405dce62f64e61506b8e155f38d8d)
[View git log for this commit](https://github.com/facebook/react/commits/81d4ee9ca5c405dce62f64e61506b8e155f38d8d)
2022-12-23 12:30:36 +00:00
eps1lon f61282346f CHANGELOG.md Change parentheses position (#25762)
DiffTrain build for [726a40eded](https://github.com/facebook/react/commit/726a40eded10172e94678c93f6c24901201de4c3)
[View git log for this commit](https://github.com/facebook/react/commits/726a40eded10172e94678c93f6c24901201de4c3)
2022-12-23 11:50:03 +00:00
acdlite 769cfc729f Bugfix: Synchronous ping during render phase sometimes unwinds the stack, leading to crash (#25851)
I found this bug when working on a different task.

`pingSuspendedRoot` sometimes calls `prepareFreshStack` to interupt the
work-in-progress tree and force a restart from the root. The idea is
that if the current render is already in a state where it be blocked
from committing, and there's new data that could unblock it, we might as
well restart from the beginning.

The problem is that this is only safe to do if `pingSuspendedRoot` is
called from a non-React task, like an event handler or a microtask.
While this is usually the case, it's entirely possible for a thenable to
resolve (i.e. to call `pingSuspendedRoot`) synchronously while the
render phase is already executing. If that happens, and work loop
attempts to unwind the stack, it causes the render phase to crash.

DiffTrain build for [5fcf1a4b4c](https://github.com/facebook/react/commit/5fcf1a4b4c2150a1b9fe0de0144a82a053c63966)
[View git log for this commit](https://github.com/facebook/react/commits/5fcf1a4b4c2150a1b9fe0de0144a82a053c63966)
2022-12-22 05:02:54 +00:00
kassens ecbf597cb6 ESLint upgrade to use hermes-eslint (#25915)
Hermes parser is the preferred parser for Flow code going forward. We
need to upgrade to this parser to support new Flow syntax like function
`this` context type annotations or `ObjectType['prop']` syntax.

Unfortunately, there's quite a few upgrades here to make it work somehow
(dependencies between the changes)

- ~Upgrade `eslint` to `8.*`~ reverted this as the React eslint plugin
tests depend on the older version and there's a [yarn
bug](https://github.com/yarnpkg/yarn/issues/6285) that prevents
`devDependencies` and `peerDependencies` to different versions.
- Remove `eslint-config-fbjs` preset dependency and inline the rules,
imho this makes it a lot clearer what the rules are.
- Remove the turned off `jsx-a11y/*` rules and it's dependency instead
of inlining those from the `fbjs` config.
- Update parser and dependency from `babel-eslint` to `hermes-eslint`.
- `ft-flow/no-unused-expressions` rule replaces `no-unused-expressions`
which now allows standalone type asserts, e.g. `(foo: number);`
- Bunch of globals added to the eslint config
- Disabled `no-redeclare`, seems like the eslint upgrade started making
this more precise and warn against re-defined globals like
`__EXPERIMENTAL__` (in rollup scripts) or `fetch` (when importing fetch
from node-fetch).
- Minor lint fixes like duplicate keys in objects.

DiffTrain build for [2b1fb91a55](https://github.com/facebook/react/commit/2b1fb91a55deb9b7b60452cb57184c2f182a42fd)
[View git log for this commit](https://github.com/facebook/react/commits/2b1fb91a55deb9b7b60452cb57184c2f182a42fd)
2022-12-20 19:35:04 +00:00
tyao1 40ea970367 Resubmit Add HydrationSyncLane (#25878)
Depends on #25876

Resubmit #25711 again(previously reverted in #25812), and added the fix
for unwinding in selective hydration during a hydration on the sync
lane.

DiffTrain build for [fabef7a6b7](https://github.com/facebook/react/commit/fabef7a6b71798fe2477720e59d090a0e74e0009)
[View git log for this commit](https://github.com/facebook/react/commits/fabef7a6b71798fe2477720e59d090a0e74e0009)
2022-12-15 20:32:31 +00:00
tyao1 5507039246 Fix unwinding context during selective hydration (#25876)
This PR includes the previously reverted #25695 and #25754, and the fix
for the regression test added in #25867.

Tested internally with a previous failed test,  and it's passing now.

Co-authored-by: Andrew Clark <git@andrewclark.io>

DiffTrain build for [7efa9e5970](https://github.com/facebook/react/commit/7efa9e59707b341f10fab79724e0fca373187925)
[View git log for this commit](https://github.com/facebook/react/commits/7efa9e59707b341f10fab79724e0fca373187925)
2022-12-15 19:56:15 +00:00
sebmarkbage 6b305241a2 Rename experimental useEvent to useEffectEvent (#25881)
We originally had grand plans for using this Event concept for more but
now it's only meant to be used in combination with effects.

It's an Event in the FRP terms, that is triggered from an Effect.
Technically it can also be from another function that itself is
triggered from an existing side-effect but that's kind of an advanced
case.

The canonical case is an effect that triggers an event:

```js
const onHappened = useEffectEvent(() => ...);
useEffect(() => {
  onHappened();
}, []);
```

DiffTrain build for [84a0a171ea](https://github.com/facebook/react/commit/84a0a171ea0ecd25e287bd3d3dd30e932beb4677)
[View git log for this commit](https://github.com/facebook/react/commits/84a0a171ea0ecd25e287bd3d3dd30e932beb4677)
2022-12-14 20:16:35 +00:00
kassens 385f204190 [react-www] remove forked bundle (#25866)
*NOTE:* re-apply of 645ae2686b now that
www is updated.

The `enableNewReconciler` was gone with
420f0b7fa1, this removes the bundle
config.

DiffTrain build for [4dda96a407](https://github.com/facebook/react/commit/4dda96a4071d2cc4bbcc444438cfacee991f07e2)
[View git log for this commit](https://github.com/facebook/react/commits/4dda96a4071d2cc4bbcc444438cfacee991f07e2)
2022-12-13 15:53:51 +00:00
poteto 63c766e21b Revert "Fork ReactDOMSharedInternals for www (#25791)" (#25864)
We did some cleanup internally of our ReactDOM module, so this fork
should be safe to remove now. Will land this only after our internal
diff lands.

DiffTrain build for [9c09c1cd62](https://github.com/facebook/react/commit/9c09c1cd62ef862df91bcb4df4271917629d6963)
[View git log for this commit](https://github.com/facebook/react/commits/9c09c1cd62ef862df91bcb4df4271917629d6963)
2022-12-12 17:48:11 +00:00
sammy-SC 806f024380 Offscreen add attach (#25603)
`Offscreen.attach` is imperative API to signal to Offscreen that its
updates should be high priority and effects should be mounted. Coupled
with `Offscreen.detach` it gives ability to manually control Offscreen.
Unlike with mode `visible` and `hidden`, it is developers job to make
sure contents of Offscreen are not visible to users.
`Offscreen.attach` only works if mode is `manual`.

Example uses:
```jsx
let offscreenRef = useRef(null);
<Offscreen mode={'manual'} ref={offscreenRef)}>
  <Child />
</Offscreen>

// ------

// Offscreen is attached by default.
// For example user scrolls away and Offscreen subtree is not visible anymore.
offscreenRef.current.detach();

// User scrolls back and Offscreen subtree is visible again.
offscreenRef.current.attach();
```

Co-authored-by: Andrew Clark <git@andrewclark.io>

DiffTrain build for [996e4c0d56](https://github.com/facebook/react/commit/996e4c0d56dabab382ca932cd5b8517e63020999)
[View git log for this commit](https://github.com/facebook/react/commits/996e4c0d56dabab382ca932cd5b8517e63020999)
2022-12-12 14:07:29 +00:00
sammy-SC a434b3ebf5 Add support for setNativeProps to Fabric (#25737)
Add support for `setNativeProps` in Fabric to make migration to the new
architecture easier. The React Native part of this has already landed in
the core and iOS in
https://github.com/facebook/react-native/commit/1d3fa40c59b234f21f516db85c322ec0ed0311e0.

It is still recommended to move away from `setNativeProps` because the
API will not work with future features.

DiffTrain build for [b14d7fa4b8](https://github.com/facebook/react/commit/b14d7fa4b88dad5f0017d084e462952c700aa2ad)
[View git log for this commit](https://github.com/facebook/react/commits/b14d7fa4b88dad5f0017d084e462952c700aa2ad)
2022-12-09 14:50:49 +00:00
poteto ba16451476 [DiffTrain] Add github url for the commit to the commit message (#25845)
Currently we just append the ref for the commit, let's make it clickable
for easier debugging in syncs.

DiffTrain build for [1c7055ddbb](https://github.com/facebook/react/commit/1c7055ddbbdae81224f998e42832d882fde06686)
[View git log for this commit](https://github.com/facebook/react/commits/1c7055ddbbdae81224f998e42832d882fde06686)
2022-12-08 19:30:40 +00:00
eps1lon ba349c70a5 [Float] Fix typo in ReactDOMResourceValidation.js (#25798)
Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>

DiffTrain build for `81968727985a7afe6fc05d77a75d8a53ab10e39b`
2022-12-08 05:16:12 +00:00
gnoff 117fb14190 fix tests for when float is off (#25839)
Some tests fail when float is off but when singletons are on. This PR
makes some adjustments

1. 2 singleton tests assert float semantics so will fail.
2. the float dispatcher was being set on the server even when float was
off. while the float calls didn't do anything warnings were still
generated. Instead we provide an empty object for the dispatcher if
float is off. Longer term the dispatcher should move to formatconfig and
just reference the float methods if the flag is on
3. some external fizz runtime tests did not gate against float but
should have

DiffTrain build for `5dfc485f6957bf941fcd9565e0271aea019d7c9e`
2022-12-07 20:58:50 +00:00
mondaychen 03bb771664 React DevTools 4.27.0 -> 4.27.1 (#25835)
patch for devtools bug

DiffTrain build for `827cbdbcc694e1aa9f4a8768c8677a1531c77ea3`
2022-12-07 17:32:04 +00:00
sebmarkbage 84822107bf toString children of title (#25838)
children of title can either behave like children or like an attribute.
We're kind of treating it more like an attribute now so we should
support toString/valueOf like we do on attributes.

DiffTrain build for `bfcbf3306794eb3de37d866551127fc2bdae53d7`
2022-12-07 14:50:05 +00:00
rickhanlonii eb06c12068 Revert "[react-www] remove forked bundle" (#25837)
Reverts facebook/react#25831

DiffTrain build for `d4bc16a7d69eb2ea38a88c8ac0b461d5f72cdcab`
2022-12-07 00:21:28 +00:00
mondaychen a9aa724b91 [bug fix] revert values in ReactFiberFlags to keep consistency for devtools (#25832)
## Summary

We see recent bug reports like #25755 and #25769 for devtools. Whenever
a component uses hook `useEffect`, it triggers an error.
This was introduced in #25663 when we try to keep the `ReactFiberFlags`
numbers consistent with reconciler, in order to fix an issue with server
components.
However, the values of `ReactFiberFlags` in reconciler were actually
changed a while ago in
https://github.com/facebook/react/commit/b4204ede66284e7153ffb11fd434cd9b9a64a56f
We made this mistake because, although it's not mentioned in the
comment, `DidCapture` and `Hydrating` are actually used by DevTools

This caused
- the latest (not stable) react version is broken on devtools before
4.27.0 (but only in uncommon cases such server components)
- all earlier react versions are broken on latest devtools (4.27.0)

To keep most versions work, we need to revert the commit that changed
the `ReactFiberFlags` values

## How did you test this change?

1. add a `useEffect` in a component in the TodoList of the shell,
trigger the error in devtools
2. after change, the error is gone

DiffTrain build for `d69b2cf8208848b0f71b5214ddff55a1ff437cc8`
2022-12-06 22:32:25 +00:00
kassens a591e1c575 [react-www] remove forked bundle (#25831)
The `enableNewReconciler` was gone with
420f0b7fa1, this removes the bundle
config.

DiffTrain build for `645ae2686b157c9f80193e1ada75b7e00ef49acf`
2022-12-06 21:19:22 +00:00
eps1lon 436cadcecd fix invalid link to react-devtools-extensions/src/__tests__ (#25816)
DiffTrain build for `7db45b9a38b8d1b5b945756cf38a174c1ec6118a`
2022-12-06 20:28:06 +00:00
poteto 562294de06 [DiffTrain] Add REVISION and REVISION_TRANSFORM to output (#25830)
We use these for the sync script, so to preserve option value let's
continue adding these files so the script can still be used for
arbitrary commits.

DiffTrain build for `c961f2f476092a138da5082dfc12916d85509649`
2022-12-06 18:03:38 +00:00
poteto 2b6133e035 [DiffTrain] Strip @license from files (#25821)
We need to remove this for some internal tests. This was previously in
our upgrade script so adding it back here for parity.

Test plan: files were updated correctly
[[1]](https://github.com/facebook/react/commit/1704bbb8268345bf7aa405101313b3639e03e221#diff-80b968e05ce2ceeff6e17c938dc722aff2c1c660f8ef402e6664bc5b2cafa5fbL2)
[[2]](https://github.com/facebook/react/commit/1704bbb8268345bf7aa405101313b3639e03e221#diff-6ecd07a61c8e0e28793dace3f9f62751e4808de9c2965aa1ddeb0157f3c9b4ecL2)

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

DiffTrain build for `7c39922891bf8e0ce179a78a373a61b3afe3c1c7`
2022-12-06 17:08:46 +00:00
kassens 30bcb2a2eb Bump qs from 6.4.0 to 6.4.1 in /fixtures/attribute-behavior (#25820)
Bumps [qs](https://github.com/ljharb/qs) from 6.4.0 to 6.4.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/ljharb/qs/blob/main/CHANGELOG.md">qs's
changelog</a>.</em></p>
<blockquote>
<h2><strong>6.4.1</strong></h2>
<ul>
<li>[Fix] <code>parse</code>: ignore <code>__proto__</code> keys (<a
href="https://github-redirect.dependabot.com/ljharb/qs/issues/428">#428</a>)</li>
<li>[Fix] fix for an impossible situation: when the formatter is called
with a non-string value</li>
<li>[Fix] use <code>safer-buffer</code> instead of <code>Buffer</code>
constructor</li>
<li>[Fix] <code>utils.merge</code>: avoid a crash with a null target and
an array source</li>
<li>[Fix]<code> </code>utils.merge`: avoid a crash with a null target
and a truthy non-array source</li>
<li>[Fix] <code>stringify</code>: fix a crash with
<code>strictNullHandling</code> and a custom
<code>filter</code>/<code>serializeDate</code> (<a
href="https://github-redirect.dependabot.com/ljharb/qs/issues/279">#279</a>)</li>
<li>[Fix] <code>utils</code>: <code>merge</code>: fix crash when
<code>source</code> is a truthy primitive &amp; no options are
provided</li>
<li>[Fix] when <code>parseArrays</code> is false, properly handle keys
ending in <code>[]</code></li>
<li>[Robustness] <code>stringify</code>: avoid relying on a global
<code>undefined</code> (<a
href="https://github-redirect.dependabot.com/ljharb/qs/issues/427">#427</a>)</li>
<li>[Refactor] use cached <code>Array.isArray</code></li>
<li>[Refactor] <code>stringify</code>: Avoid arr = arr.concat(...), push
to the existing instance (<a
href="https://github-redirect.dependabot.com/ljharb/qs/issues/269">#269</a>)</li>
<li>[readme] remove travis badge; add github actions/codecov badges;
update URLs</li>
<li>[Docs] Clarify the need for &quot;arrayLimit&quot; option</li>
<li>[meta] fix README.md (<a
href="https://github-redirect.dependabot.com/ljharb/qs/issues/399">#399</a>)</li>
<li>[meta] Clean up license text so it’s properly detected as
BSD-3-Clause</li>
<li>[meta] add FUNDING.yml</li>
<li>[actions] backport actions from main</li>
<li>[Tests] remove nonexistent tape option</li>
<li>[Dev Deps] backport from main</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/ljharb/qs/commit/486aa46547b4e878d6e87183de95dd26d46fb020"><code>486aa46</code></a>
v6.4.1</li>
<li><a
href="https://github.com/ljharb/qs/commit/727ef5d34605108acb3513f72d5435972ed15b68"><code>727ef5d</code></a>
[Fix] <code>parse</code>: ignore <code>__proto__</code> keys (<a
href="https://github-redirect.dependabot.com/ljharb/qs/issues/428">#428</a>)</li>
<li><a
href="https://github.com/ljharb/qs/commit/cd1874eb179950de3f5b32e708b4a3a2d0619501"><code>cd1874e</code></a>
[Robustness] <code>stringify</code>: avoid relying on a global
<code>undefined</code> (<a
href="https://github-redirect.dependabot.com/ljharb/qs/issues/427">#427</a>)</li>
<li><a
href="https://github.com/ljharb/qs/commit/45e987c6038db47199a560294c20a67da9ab49e3"><code>45e987c</code></a>
[readme] remove travis badge; add github actions/codecov badges; update
URLs</li>
<li><a
href="https://github.com/ljharb/qs/commit/90a3bced518c6ff4a97919d10de9498fea961acf"><code>90a3bce</code></a>
[meta] fix README.md (<a
href="https://github-redirect.dependabot.com/ljharb/qs/issues/399">#399</a>)</li>
<li><a
href="https://github.com/ljharb/qs/commit/9566d25019caae8c4f1a9097bf344238a583d014"><code>9566d25</code></a>
[Fix] fix for an impossible situation: when the formatter is called with
a no...</li>
<li><a
href="https://github.com/ljharb/qs/commit/74227ef022282881f41d37d65adba5d399d2b33a"><code>74227ef</code></a>
Clean up license text so it’s properly detected as BSD-3-Clause</li>
<li><a
href="https://github.com/ljharb/qs/commit/35dfb227e274367e163b3d943fc975f95448685a"><code>35dfb22</code></a>
[actions] backport actions from main</li>
<li><a
href="https://github.com/ljharb/qs/commit/7d4670fca6ed46a1fc6237bccffe0ea82a641411"><code>7d4670f</code></a>
[Dev Deps] backport from main</li>
<li><a
href="https://github.com/ljharb/qs/commit/0485440902d3fc03d1d973d91af5a183fa4e3059"><code>0485440</code></a>
[Fix] use <code>safer-buffer</code> instead of <code>Buffer</code>
constructor</li>
<li>Additional commits viewable in <a
href="https://github.com/ljharb/qs/compare/v6.4.0...v6.4.1">compare
view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=qs&package-manager=npm_and_yarn&previous-version=6.4.0&new-version=6.4.1)](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 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)
- `@dependabot use these labels` will set the current labels as the
default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as
the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as
the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the
default for future PRs for this repo and language

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 `2f16409f3a40de334973abdcba08e09284ed1c9d`
2022-12-06 16:59:09 +00:00
poteto 1704bbb826 [DiffTrain] Strip @license from files
DiffTrain build for `29bb7f8a2fbdbb5d8a6e95c4ba6221d9c50d23af`
2022-12-06 16:45:18 +00:00
acdlite 1d718367ec Revert recent hydration changes (#25812)
We're reverting the stack of changes that this code belongs to in order
to unblock the sync to Meta's internal codebase. We will attempt to
re-land once the sync is unblocked.

I have not yet verified that this fixes the error that were reported
internally. I will do that before landing.

DiffTrain build for `d807eb52cfd999cfbcb19078a75b15f844e409bb`
2022-12-05 21:17:13 +00:00
kassens 98926ac94e Fork ReactDOMSharedInternals for www (#25791)
This isn't the right way to do this, but internally we have some
restrictions so we need to add an indirection. Let's land this now so we
can catch up our sync and then fix forward from there.

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

DiffTrain build for `2ccfa657d9529cab25eaa25144efc64df12b13c7`
2022-12-05 20:33:42 +00:00
poteto cf2ede19b3 [DiffTrain] Use original commit message (#25809)
Instead of the current commit message (which just shows "Build for
<sha>", re-use the commit message from the origin commit instead.

DiffTrain build for `cd23e40c734d758726419c0a3bd91576211bd83f`
2022-12-05 19:03:53 +00:00
poteto f965082ab3 [DiffTrain] Use original commit message
Instead of the current commit message (which just shows "Build for
<sha>", re-use the commit message from the origin commit instead.

Built for DiffTrain for `4b8a8376689cc70225b36a59ea71992e36c3a90f)`
2022-12-05 18:45:21 +00:00