Commit Graph

206 Commits

Author SHA1 Message Date
hoxyq c0fdffd76d chore[devtools]: upgrade to webpack v5 (#26887)
## Summary
- Updated `webpack` (and all related packages) to v5 in
`react-devtools-*` packages.
- I haven't touched any `TODO (Webpack 5)`. Tried to poke it, but each
my attempt failed and parsing hook names feature stopped working. I will
work on this in a separate PR.
- This work is one of prerequisites for updating Firefox extension to
manifests v3

related PRs:
https://github.com/facebook/react/pull/22267
https://github.com/facebook/react/pull/26506

## How did you test this change?
Tested on all surfaces, explicitly checked that parsing hook names
feature still works.

DiffTrain build for commit https://github.com/facebook/react/commit/4ddc019aca8e08fd59cb43de5e0032be77d6174e.
2023-06-14 12:21:33 +00:00
hoxyq a4ddd5a4d9 fix[devtools]: display NaN as string in values (#26947)
## Summary

>Warning: Received NaN for the `children` attribute. If this is
expected, cast the value to a string.

Fixes this warning, when we try to display NaN as NaN in key-value list.

DiffTrain build for commit https://github.com/facebook/react/commit/f5c249db8b0bec00faa9633d67814e980c24fbb5.
2023-06-14 10:51:21 +00:00
sebmarkbage 8d784b2bde [Flight] Only skip past the end boundary if there is a newline character (#26945)
Follow up to #26932

For regular rows, we're increasing the index by one to skip past the
last trailing newline character which acts a boundary. For length
encoded rows we shouldn't skip an extra byte because it'll leave us
missing one.

This only accidentally worked because this was also the end of the
current chunk which tests don't account for since we're just passing
through the chunks. So I added some noise by splitting and joining the
chunks so that this gets tested.

DiffTrain build for commit https://github.com/facebook/react/commit/a1723e18fd42e67d610adb0107c9015319613bd7.
2023-06-14 04:56:29 +00:00
gnoff 0d865f04c8 [Float][Fizz] add crossOrigin support for preloading bootstrap scripts and bootstrap modules (#26942)
The recently merged support for crossorigin in bootstrap scripts did not
implement the functionality for preloading. This adds it

see #26844

DiffTrain build for commit https://github.com/facebook/react/commit/a7bf5ba614c6ddbd1eb3057c71f72efd1b6c21a9.
2023-06-13 21:05:24 +00:00
gnoff 64b0998822 [Float] use common float types (#26938)
Float types are currently spread out. this moves them to a single place
to ensure we properly handle the public type interface in all three
renderers.

This is a step towards moving the public interface and validation to a
common file shared by all three runtimes. Will also probably change the
function interface to be flatter

DiffTrain build for commit https://github.com/facebook/react/commit/7ed6084c39067e9a34a4d585e8dab2b75115cfa8.
2023-06-13 20:35:04 +00:00
gnoff 3270c9a65d Add support for 'crossorigin' attribute on bootstrapScripts and bootstrapModules (#26844)
base build ci job failing but this change is unrelated and I think it is just flake with the builds host application

DiffTrain build for commit https://github.com/facebook/react/commit/90229eb925e2330667fb7c023a5c4317c7ae8363.
2023-06-13 16:17:34 +00:00
hoxyq 92e7a509c6 fix: devtools cannot be closed correctly (#25510)
<!--
  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

Fix devtools cannot be shutdown by bridge.shutdown().

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

## 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.
-->

DiffTrain build for commit https://github.com/facebook/react/commit/88df88f9441e0f83917e60e04d4f75118c1adec5.
2023-06-13 09:10:22 +00:00
sebmarkbage d13c641a81 [Flight] Optimize Large Strings by Not Escaping Them (#26932)
This introduces a Text row (T) which is essentially a string blob and
refactors the parsing to now happen at the binary level.

```
RowID + ":" + "T" + ByteLengthInHex + "," + Text
```

Today, we encode all row data in JSON, which conveniently never has
newline characters and so we use newline as the line terminator. We
can't do that if we pass arbitrary unicode without escaping it. Instead,
we pass the byte length (in hexadecimal) in the leading header for this
row tag followed by a comma.

We could be clever and use fixed or variable-length binary integers for
the row id and length but it's not worth the more difficult
debuggability so we keep these human readable in text.

Before this PR, we used to decode the binary stream into UTF-8 strings
before parsing them. This is inefficient because sometimes the slices
end up having to be copied so it's better to decode it directly into the
format. The follow up to this is also to add support for binary data and
then we can't assume the entire payload is UTF-8 anyway. So this
refactors the parser to parse the rows in binary and then decode the
result into UTF-8. It does add some overhead to decoding on a per row
basis though.

Since we do this, we need to encode the byte length that we want decode
- not the string length. Therefore, this requires clients to receive
binary data and why I had to delete the string option.

It also means that I had to add a way to get the byteLength from a chunk
since they're not always binary. For Web streams it's easy since they're
always typed arrays. For Node streams it's trickier so we use the
byteLength helper which may not be very efficient. Might be worth
eagerly encoding them to UTF8 - perhaps only for this case.

DiffTrain build for commit https://github.com/facebook/react/commit/db50164dbac39d7421c936689a5c026e9fd2f034.
2023-06-13 02:21:35 +00:00
sebmarkbage 42d25ac839 Delete processStringChunk (#26896)
Follow up to #26827.

These can't include binary data and we don't really have any use cases
that really require these to already be strings.

When the stream is encoded inside another protocol - such as HTML we
need a different format that encode binary offsets and binary data.

DiffTrain build for commit https://github.com/facebook/react/commit/ce6842d8f528977119b80d969306c8475099f66e.
2023-06-10 21:04:26 +00:00
hoxyq 400079675f refactor[renderer]: expose getInspectorDataForInstance in rendererConfig (#26913)
## Summary
This is required for the case when we have an instance and want to get
inspector data for it. Such case occurs when RN's application being
debugged via React DevTools.

React DevTools sends instance to RN, which then gets all auxiliary data
to highlight some elements. Having `getInspectorDataForInstance` method
exposed makes it possible to easily get current props from fiber, which
then can be used to display some margins & paddings for hovered element
(via props.style).

I see that `getInspectorDataForInstance` is being exported at the top
level of the renderer, but feels like this should also be inside
DevTools global hook, the same way we use it for
[`getInspectorDataForViewAtPoint`](https://github.com/facebook/react-native/blob/e7d3662904e0e35e43380ee6d54859388713a592/packages/react-native/Libraries/Inspector/getInspectorDataForViewAtPoint.js).

DiffTrain build for commit https://github.com/facebook/react/commit/21a161fa37dce969c58ae17f67f2856d06514892.
2023-06-09 10:01:15 +00:00
hoxyq 8ed315a361 Fix:- Fixed dev tools inspect mode on Shadow dom (#26888)
Fixes #26200

### PR explanation

I tried to induce the change by the `event.composed` to check whether
the event was created in a ShadowRoot, And replaced `pointerOver` with
`pointerMove`, pointerOver event did not fired correctly

Before PR:-

https://github.com/facebook/react/assets/72331432/67a33dcd-447f-4c68-9c3c-ad954baddeb8

After PR:-

https://github.com/facebook/react/assets/72331432/9f986ff2-785f-4cba-a504-44f82ea9fc5a

---------

Co-authored-by: Biki das <bikidas@Bikis-MacBook-Pro.local>

DiffTrain build for commit https://github.com/facebook/react/commit/910045696bb5f693acb77890e6750c5e4659b420.
2023-06-07 15:45:51 +00:00
sebmarkbage ae6b08c855 Remove XHR support from Flight (#26827)
We currently support passing an XHR request to Flight for broader compat
and possibly better perf than `fetch()`. However, it's a little tricky
because ideally the RSC protocol is really meant to support binary data
too. XHR does support binary but it doesn't support it while also
streaming.

We could maybe support this only when you know it's going to be only
text streams but it has some limitations in how we can encode separators
if we can't use binary.

Nobody is really asking for this so we might as well delete it.

DiffTrain build for commit https://github.com/facebook/react/commit/e6fae308e9300ca545003ac147cc7e4e541f561c.
2023-06-03 20:07:58 +00:00
sebmarkbage 696f0ab209 [Flight] Add bundler-less version of RSC using plain ESM (#26889)
This isn't really meant to be actually used, there are many issues with
this approach, but it shows the capabilities as a proof-of-concept.

It's a new reference implementation package `react-server-dom-esm` as
well as a fixture in `fixtures/flight-esm` (fork of `fixtures/flight`).
This works pretty much the same as pieces we already have in the Webpack
implementation but instead of loading modules using Webpack on the
client it uses native browser ESM.

To really show it off, I don't use any JSX in the fixture and so it also
doesn't use Babel or any compilation of the files.

This works because we don't actually bundle the server in the reference
implementation in the first place. We instead use [Node.js
Loaders](https://nodejs.org/api/esm.html#loaders) to intercept files
that contain `"use client"` and `"use server"` and replace them. There's
a simple check for those exact bytes, and no parsing, so this is very
fast.

Since the client isn't actually bundled, there's no module map needed.
We can just send the file path to the file we want to load in the RSC
payload for client references.

Since the existing reference implementation for Node.js already used ESM
to load modules on the server, that all works the same, including Server
Actions. No bundling.

There is one case that isn't implemented here. Importing a `"use
server"` file from a Client Component. We don't have that implemented in
the Webpack reference implementation neither - only in Next.js atm. In
Webpack it would be implemented as a Webpack loader.

There are a few ways this can be implemented without a bundler:

- We can intercept the request from the browser importing this file in
the HTTP server, and do a quick scan for `"use server"` in the file and
replace it just like we do with loaders in Node.js. This is effectively
how Vite works and likely how anyone using this technique would have to
support JSX anyway.
- We can use native browser "loaders" once that's eventually available
in the same way as in Node.js.
- We can generate import maps for each file and replace it with a
pointer to a placeholder file. This requires scanning these ahead of
time which defeats the purposes.

Another case that's not implemented is the inline `"use server"` closure
in a Server Component. That would require the existing loader to be a
bit smarter but would still only "compile" files that contains those
bytes in the fast path check. This would also happen in the loader that
already exists so wouldn't do anything substantially different than what
we currently have here.

DiffTrain build for commit https://github.com/facebook/react/commit/f181ba8aa6339d62f6e2572109c61242606f16b3.
2023-06-03 20:03:31 +00:00
gnoff adc3ea9443 [Fizz][Float] stop automatically preloading scripts that are not script resources (#26877)
Currently we preload all scripts that are not hoisted. One of the
original reasons for this is we stopped SSR rendering async scripts that
had an onLoad/onError because we needed to be able to distinguish
between Float scripts and non-Float scripts during hydration. Hydration
has been refactored a bit and we can not get around this limitation so
we can just emit the async script in place. However, sync and defer
scripts are also preloaded. While this is sometimes desirable it is not
universally so and there are issues with conveying priority properly
(see fetchpriority) so with this change we remove the automatic
preloading of non-Float scripts altogether.

For this change to make sense we also need to emit async scripts with
loading handlers during SSR. we previously only preloaded them during
SSR because it was necessary to keep async scripts as unambiguously
resources when hydrating. One ancillary benefit was that load handlers
would always fire b/c there was no chance the script would run before
hydration. With this change we go back to having the ability to have
load handlers fired before hydration. This is already a problem with
images and we don't have a generalized solution for it however our
likely approach to this sort of thing where you need to wait for a
script to load is to use something akin to `importScripts()` rather than
rendering a script with onLoad.

DiffTrain build for commit https://github.com/facebook/react/commit/e1ad4aa3615333009d76f947ff05ddeff01039c6.
2023-06-01 20:39:21 +00:00
gnoff c52503442d [Fizz][Float] stop preloading stylesheets that are not stylesheet resources (#26873)
We previously preloaded stylesheets that were rendered in Fizz. The idea
was we'd get a headstart fetching these resources since we know they are
going to be rendered. However to really be effective non-float
stylesheets need to rendered in the head and the preload here is not
helpful and potentially hurtful to perf in a minor way. This change
removes this functionality to make the code smaller and simpler

DiffTrain build for commit https://github.com/facebook/react/commit/5fb2c15a89de844a1dd12a61e7674e55dc0dfa89.
2023-06-01 20:29:40 +00:00
gnoff be35c8a6ef [Float] support fetchpriority on ReactDOM.preload() and ReactDOM.preinit() (#26880)
exposes fetchPriority as an option for `ReactDOM.preload()` and
`ReactDOM.preinit()`

the typings should be `'high' | 'low' | 'auto'`

DiffTrain build for commit https://github.com/facebook/react/commit/042d8f606ce643d2eca955badbf07ea5b8ac266c.
2023-06-01 20:17:31 +00:00
tyao1 2c4d9cef8b Always trigger componentWillUnmount in StrictMode (#26842)
<!--
  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?
-->
In StrictMode, React currently only triggers `componentWillUnmount` if
`componentDidMount` is defined. This would miss detecting issues like
initializing resources in constructor or componentWillMount, for
example:
```
class Component {
  constructor() {
     this._subscriptions = new Subscriptions();
  }
  componentWillUnmount() {
     this._subscriptions.reset();
  }
}
```

The PR makes `componentWillUnmount` always run in StrictMode.

## 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 ci`

DiffTrain build for commit https://github.com/facebook/react/commit/811022232efed62a3c943701bc99d18655bc78b3.
2023-06-01 17:40:16 +00:00
rickhanlonii b80a98a52d Clean up enableSyncDefaultUpdates flag a bit (#26858)
## Overview

Does a few things:
- Renames `enableSyncDefaultUpdates` to
`forceConcurrentByDefaultForTesting`
- Changes the way it's used so it's dead-code eliminated separate from
`allowConcurrentByDefault`
- Deletes a bunch of the gated code

The gates that are deleted are unnecessary now. We were keeping them
when we originally thought we would come back to being concurrent by
default. But we've shifted and now sync-by default is the desired
behavior long term, so there's no need to keep all these forked tests
around.

I'll follow up to delete more of the forked behavior if possible.
Ideally we wouldn't need this flag even if we're still using
`allowConcurrentByDefault`.

DiffTrain build for commit https://github.com/facebook/react/commit/018c58c9c65452cff25aaf1f38f78a9b90d8e5c1.
2023-06-01 13:31:00 +00:00
gnoff 4c0c82b945 [Fizz] preload bootstrapModules (#26754)
stacked on #26753

Adds support for preloading bootstrapModules. We don't yet support
modules in Float's public interface but this implementation should be
compatible with what we do when we add it.

DiffTrain build for commit https://github.com/facebook/react/commit/ae31d2ea3c3f9f0a87ff2c6193484d5d8786bc5f.
2023-05-31 23:53:03 +00:00
gnoff 8eeccff021 [Fizz] preload bootstrapScripts (#26753)
This PR adds a preload for bootstrapScripts. preloads are captured
synchronously when you create a new Request and as such the normal logic
to check if a preload already exists is skipped.

DiffTrain build for commit https://github.com/facebook/react/commit/b864ad4397e7b366ece9ecfdfafa5660ae6b8390.
2023-05-31 23:30:27 +00:00
gnoff 6e4ace8a25 [Fiber][Float] preinitialized stylesheets should support integrity option (#26881)
preinitialized stylesheets did not render the integrity option on the
client implementation of Float. This was an oversight.

DiffTrain build for commit https://github.com/facebook/react/commit/e1e68b9f7ffecf98e1b625cfe3ab95741be1417b.
2023-05-31 20:53:54 +00:00
gnoff 8f0236b525 [Fiber] retain scripts on clearContainer and clearSingleton (#26871)
clearContainer and clearSingleton both assumed scripts could be safely
removed from the DOM because normally once a script has been inserted
into the DOM it is executable and removing it, even synchronously, will
not prevent it from running. However There is an edge case in a couple
browsers (Chrome at least) where during HTML streaming if a script is
opened and not yet closed the script will be inserted into the document
but not yet executed. If the script is removed from the document before
the end tag is parsed then the script will not run. This change causes
clearContainer and clearSingleton to retain script elements. This is
generally thought to be safe because if we are calling these methods we
are no longer hydrating the container or the singleton and the scripts
execution will happen regardless.

DiffTrain build for commit https://github.com/facebook/react/commit/1cea384480a6dea80128e5e0ddb714df7bea1520.
2023-05-30 20:18:41 +00:00
sebmarkbage 67de87bc01 Compare name when hydrating hidden fields to filter out extra form action fields (#26846)
This solves an issue where if you inject a hidden field in the beginning
of the form, we might mistakenly hydrate the injected one that was part
of an action.

I'm not too happy about how specific this becomes. It's similar to Float
but in general we don't do this deep comparison.

See https://github.com/vercel/next.js/issues/50087

DiffTrain build for commit https://github.com/facebook/react/commit/a1f97589fd298cd71f97339a230f016139c7382f.
2023-05-26 16:58:39 +00:00
rickhanlonii f3bd734469 Update enableSyncDefaultUpdates for www (#26857)
If this is false, it dead code eliminates the path to use the root flag.
Will follow up to clean this up.

DiffTrain build for commit https://github.com/facebook/react/commit/0210f0b082c95f5aec08f356d796c512eab44fc4.
2023-05-26 01:37:57 +00:00
acdlite e7364586d1 Remove temporary CircleCI workaround (#26855)
There was a CircleCI bug that prevented the sizebot job from accessing
the artifacts API. I had added a temporary workaround to pull from a
mirror instead. This seems to have been fixed, so I can remove the
workaround.

DiffTrain build for commit https://github.com/facebook/react/commit/4daccade04ae54339463546e06f07db56a646bd4.
2023-05-25 17:43:38 +00:00
kassens 49e9133a4b [flow] upgrade to 0.206.0 (#26850)
Small upgrade. The one impact was deprecation of `$Shape` where it seems
like we can just use a plain object with optional key.

DiffTrain build for commit https://github.com/facebook/react/commit/18dedde6a7d63ffafd2f7e135f9edf424eee0bcd.
2023-05-25 17:43:19 +00:00
kassens eb5c467b36 run SchedulerFeatureFlags with variant flags again (#26851)
With df12d7eac4 I accidentally made it so
that tests aren't run with the 2 variant modes for most
SchedulerFeatureFlags anymore. This fixes it with the same approach as
ee4233bdbc.

Test Plan:
Run and notice the boolean flags follow the variant:
```
yarn test-www --variant=true
yarn test-www --variant=false
```

DiffTrain build for commit https://github.com/facebook/react/commit/9a72e622716f6dab714ebe8b957ee9970154664b.
2023-05-25 14:43:16 +00:00
rickhanlonii 475ee24eba Move enableSyncDefaultUpdates to test config (#26847)
DiffTrain build for commit https://github.com/facebook/react/commit/ee4233bdbc71a7e09395a613c7dde01194d2a830.
2023-05-24 22:30:45 +00:00
sammy-SC 92b9d94300 Add $FlowFixMe to fix React Native DiffTrain (#26841)
DiffTrain build for commit https://github.com/facebook/react/commit/6fc3333b685657c8e6425df9fcb4fe1ce7374d40.
2023-05-24 16:47:45 +00:00
gnoff ff94fad9a1 Update preload links to support nonce and fetchpriority (#26826)
Currently when React generates rel=preload link tags for script/stylesheet resources, it will not carryover nonce and fetchpriority values if specified on the original elements.

This change ensures that the preload links use the nonce and fetchPriority values if they were specified.

DiffTrain build for commit https://github.com/facebook/react/commit/535c038d15d21f33e678187410d658456cc0ce39.
2023-05-23 03:01:01 +00:00
sophiebits 1bffb4ba16 Updated Copyright comment from Facebook to Meta (#26833)
## Summary
Changed the comment in react/packages/react
/react.shared-subset.js saying
```
Copyright (c) Facebook, Inc. and affiliates ..
```
To
```
Copyright (c) Meta Platforms, Inc. and affiliates ..
```
as raised in the following issues:
https://github.com/facebook/react/issues/26829

Files Changed:
react/packages/react/react.shared-subset.js

## How did you test this change?

Tests Required: No

DiffTrain build for commit https://github.com/facebook/react/commit/7bd330e0b0d740e4ffda25a179a4d06081f1b8e7.
2023-05-20 00:59:09 +00:00
sophiebits 5112e9fbcf Updated copyright text to Copyright (c) Meta Platforms, Inc. and its … (#26830)
…affiliates.

## Summary

There were 8 different places where the copyright comment was wrong.
Rewrote from "Copyright (c) Facebook, Inc. and its affiliates." to
"Copyright (c) Meta Platforms, Inc. and its affiliates."

## How did you test this change?
No code was changed. Comment was still a comment after changes.

Co-authored-by: Dennis Moradkhani <denmo530@student.liu.se>

DiffTrain build for commit https://github.com/facebook/react/commit/4b877b6c661417e932056e12732e3d2697562dc8.
2023-05-20 00:58:11 +00:00
sebmarkbage 3c60dbb4dc Remove Flight Relay DOM/Native (#26828)
The bindings upstream in Relay has been removed so we don't need these
builds anymore. The idea is to revisit an FB integration of Flight but
it wouldn't use the Relay specific bindings. It's a bit unclear how it
would look but likely more like the OSS version so not worth keeping
these around.

The `dom-relay` name also included the FB specific Fizz implementation
of the streaming config so I renamed that to `dom-fb`. There's no Fizz
implementation for Native yet so I just removed `native-relay`.

We created a configurable fork for how to encode the output of Flight
and the Relay implementation encoded it as JSON objects instead of
strings/streams. The new implementation would likely be more stream-like
and just encode it directly as string/binary chunks. So I removed those
indirections so that this can just be declared inline in
ReactFlightServer/Client.

DiffTrain build for commit https://github.com/facebook/react/commit/5309f102854475030fb91ab732141411b49c1126.
2023-05-18 00:39:21 +00:00
hoxyq 7198d1e104 Fix strict mode badge URL (#26825)
## Summary
Closes https://github.com/facebook/react/issues/26821

[[Fix #26821]](https://github.com/facebook/react/issues/26821) Update
strict mode badge URL

Updated the URL in the strict mode badge to point to the correct React
documentation for StrictMode. The previous URL was outdated. Now, when a
component is not running in StrictMode, the badge links to
https://react.dev/reference/react/StrictMode for more information.

## How did you test this change?

I verified that the strict mode badge now correctly links to the updated
URL. Previously, it pointed to the outdated URL
(https://fb.me/devtools-strict-mode). After the update, it correctly
points to the React Dev documentation for StrictMode
(https://react.dev/reference/react/StrictMode).

_Since its my first contribution here, i have completed the CLA_

DiffTrain build for commit https://github.com/facebook/react/commit/d7a98a5e97c3512ba43dd809337ae1691df1ae66.
2023-05-17 12:40:14 +00:00
hoxyq 04297e11bd React DevTools 4.27.7 -> 4.27.8 (#26823)
Closes https://github.com/facebook/react/issues/26787,
https://github.com/facebook/react/issues/26793

Includes these changes:
* fix[devtools]: fixed duplicated backend activation with multiple
renderers ([hoxyq](https://github.com/hoxyq) in
[#26807](https://github.com/facebook/react/pull/26807))

DiffTrain build for commit https://github.com/facebook/react/commit/2468a87358de55137508e777846746091d7a1514.
2023-05-17 10:47:19 +00:00
acdlite 0d0ce18354 Lower Suspense throttling heuristic to 300ms (#26803)
Now that the throttling mechanism applies more often, we've decided to
lower this a tad to ensure it's not noticeable. The idea is it should be
just large enough to prevent jank when lots of different parts of the UI
load in rapid succession, but not large enough to make the UI feel
sluggish. There's no perfect number, it's just a heuristic.

DiffTrain build for commit https://github.com/facebook/react/commit/f8de255e94540f9018d8196b3a34da500707c39b.
2023-05-16 20:05:12 +00:00
acdlite c488cce876 Fix Suspense throttling mechanism (#26802)
The throttling mechanism for fallbacks should apply to both their
appearance _and_ disappearance.

This was mostly addressed by #26611. See that PR for additional context.

However, a flaw in the implementation is that we only update the the
timestamp used for throttling when the fallback initially appears. We
don't update it when the real content pops in. If lots of content in
separate Suspense trees loads around the same time, you can still get
jank.

The issue is fixed by updating the throttling timestamp whenever the
visibility of a fallback changes. Not just when it appears.

DiffTrain build for commit https://github.com/facebook/react/commit/4bfcd02b2cebcb390f5aff0d7747c60a55012d5d.
2023-05-16 19:09:29 +00:00
sophiebits 3546b414cc Fix uSES hydration in strict mode (#26791)
Previously, we'd call and use getSnapshot on the second render resulting
in `Warning: Text content did not match. Server: "Nay!" Client: "Yay!"`
and then `Error: Text content does not match server-rendered HTML.`.

Fixes #26095. Closes #26113. Closes #25650.

---------

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

DiffTrain build for commit https://github.com/facebook/react/commit/4cd7065665ea2cf33c306265c8d817904bb401ca.
2023-05-12 21:22:47 +00:00
Pieter Vanderwerff 19188c459e Presuppress Flow errors for 0.206 in fbsource
Differential Revision: D45756542nnPull Request resolved: https://github.com/facebook/react-fbsource-import/pull/4
2023-05-12 11:15:56 -07:00
javache be012b06a3 [react-native] Always set RN$stopSurface (#26808)
## Summary
To support incremental adoption of bridgeless logic we want to default
to using these globals whenever they're available.

## How did you test this change?
https://github.com/facebook/react-native/pull/37410

DiffTrain build for commit https://github.com/facebook/react/commit/a389046a529c6d22ba5895dd7f5d4b0b8d17c345.
2023-05-12 15:21:33 +00:00
hoxyq 377d1e5b74 fix[devtools]: fixed duplicated backend activation with multiple renderers (#26807)
## Summary
Initially reported in https://github.com/facebook/react/issues/26797.
Was not able to reproduce the exact same problem, but found this case:

1. Open corresponding codepen from the issue in debug mode
2. Open components tab of the extension
3. Refresh the page

Received multiple errors:
- Warning in the Console tab: Invalid renderer id "2".
- Error in the Components tab: Uncaught Error: Cannot add node "3"
because a node with that id is already in the Store.

This problem has occurred after landing a fix in
https://github.com/facebook/react/pull/26779. Looks like Chrome is
keeping the injected scripts (the backend in this case) and we start
backend twice.

DiffTrain build for commit https://github.com/facebook/react/commit/67a05d03e38b9837e27c9fe0a673557e63ff03c5.
2023-05-12 14:04:43 +00:00
kassens 421c52f05d [www] reduce dynamic SchedulerFeatureFlags (#26617)
For these values we're not using dynamic values. We can statically
compile in the values we're running.

DiffTrain build for commit https://github.com/facebook/react/commit/df12d7eac40c87bd5fdde0aa5a739bce9e7dce27.
2023-05-10 21:31:51 +00:00
acdlite 8bd06fd0d6 Fix nightly job to publish to "canary" channel (#26799)
When I was renaming the next channel to canary, I updated the
`publish_preleases` workflow correctly, but I skipped over
`publish_preleases_nightly`. Oops.

DiffTrain build for commit https://github.com/facebook/react/commit/7cd98ef2bcbc10f164f778bade86a4daeb821011.
2023-05-10 02:32:36 +00:00
acdlite a25fa24bd9 Change yarn test to default to experimental (#26741)
The idea is that the default `yarn test` command should be the one that
includes the most bleeding edge features, because during development you
probably want as many features enabled as possible.

That used to be `www-modern` but nowadays it's `experimental` because
we've landed a bunch of async actions stuff in experimental but it isn't
yet being tested at Meta.

So this switches the default to `experimental`.

DiffTrain build for commit https://github.com/facebook/react/commit/b5810163e913e8c95a7a0a6dee039bc102e3c987.
2023-05-10 01:56:15 +00:00
kassens 6227a7fd81 Flow upgrade to 0.205.1 (#26796)
Just a small upgrade to keep us current and remove unused suppressions
(probably fixed by some upgrade since).

- `*` is no longer allowed and has been an alias for `any` for a while
now.

DiffTrain build for commit https://github.com/facebook/react/commit/fda1f0b902b527089fe5ae7b3aa573c633166ec9.
2023-05-09 14:53:10 +00:00
kassens ef06657b12 Small flowconfig fixes (#26784)
- The whole project root is included by default anyway, the include
section should be redundant and just misleading.
- The generated ignore paths ignore more than intended as they didn't
escape the `.` for regex.

Test Plan:
- wait for CI
- tested the ignore pattern change with renaming files and seeing the
expected files ignored for flow

DiffTrain build for commit https://github.com/facebook/react/commit/7ac5e9a602347f3b7d26c60a549c483d3bc88bbf.
2023-05-08 16:14:43 +00:00
acdlite 4e6ccd72ab Add useFormStatus to server rendering stub (#26788)
This was an oversight when I set up the hook in #26719.

DiffTrain build for commit https://github.com/facebook/react/commit/16d053d592673dd5565d85109f259371b23f87e8.
2023-05-07 00:43:50 +00:00
gaearon d4ffe42ab7 [Release Script] Print a hint where to get the token (#26783)
I always forget where to get it.

DiffTrain build for commit https://github.com/facebook/react/commit/efb381bbf981aedbf4eb9e1bd0e6e30abce266d1.
2023-05-05 19:13:56 +00:00
sammy-SC 2d742d3f73 Use native scheduler if defined in global scope (#26554)
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

DiffTrain build for commit https://github.com/facebook/react/commit/b00e27342d6ff0f2a3a57b8e1edf66290d27cf07.
2023-05-05 13:08:11 +00:00
hoxyq 3c532c665b React DevTools 4.27.6 -> 4.27.7 (#26780)
List of changes:
* DevTools: fix backend activation ([hoxyq](https://github.com/hoxyq) in
[#26779](https://github.com/facebook/react/pull/26779))
* fix[dynamic-scripts-injection]: unregister content scripts before
registration ([hoxyq](https://github.com/hoxyq) in
[#26765](https://github.com/facebook/react/pull/26765))

DiffTrain build for commit https://github.com/facebook/react/commit/783e7fcfa3e354b3be13f5403fc2fd2260db00b4.
2023-05-04 17:28:58 +00:00