Commit Graph

15255 Commits

Author SHA1 Message Date
Jan Kassens
00a2f81508 Flow upgrade to 0.143
This was a large upgrade that removed "classic mode" and made "types first" the only option.
Most of the needed changes have been done in previous PRs, this just fixes up the last few instances.

ghstack-source-id: 9612d95ba4
Pull Request resolved: https://github.com/facebook/react/pull/25408
2022-10-04 11:01:50 -04:00
Jan Kassens
0a3072278e Flow: complete types first migration (#25389)
This complete the "types first" migration and enables the config everywhere.
2022-10-03 21:59:33 -04:00
Jan Kassens
bcc05671fc Flow: types first in shared (#25343) 2022-10-03 20:57:34 -04:00
Jan Kassens
dc52b6739e Add NodeJS 18.x as devEngine (#25348) 2022-10-03 20:57:06 -04:00
Jan Kassens
b1f34aa307 Flow: types first in react-native-renderer (#25363) 2022-10-03 17:03:33 -04:00
Jan Kassens
9143864ae1 Flow: well formed exports for smaller packages (#25361)
Enforces well formed exports for packages where the fixes are small.
2022-10-03 16:52:41 -04:00
Jan Kassens
94ac306688 CI: update CircleCI docker image (#25374)
This updates to an image that's using node 16.16.0 and java 18.0.2.

| Package | Old    | New
| ------ | ------- | ---
| git    | 2.32.0  | 2.37.1
| gradle | 7.2     | 7.5.1
| java   | 17      | 18.0.2
| maven  | 3.8.2   | 3.8.6
| node   | 14.17.6 | 16.16.0
| ubuntu | 20.04.2 LTS |  20.04.4 LTS
| yarn   | 1.22.5 |  1.22.5
2022-10-03 16:52:14 -04:00
Kirankumar Ambati
2d80a0cd69 Fix: Updated link in CONTRIBUTING (#25381) 2022-10-03 10:29:57 -04:00
dependabot[bot]
041dbe2e1f Bump eventsource from 1.0.7 to 1.1.2 (#25386)
Bumps [eventsource](https://github.com/EventSource/eventsource) from 1.0.7 to 1.1.2.
- [Release notes](https://github.com/EventSource/eventsource/releases)
- [Changelog](https://github.com/EventSource/eventsource/blob/master/HISTORY.md)
- [Commits](https://github.com/EventSource/eventsource/compare/v1.0.7...v1.1.2)

---
updated-dependencies:
- dependency-name: eventsource
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-03 10:28:38 -04:00
dependabot[bot]
55811834b0 Bump eventsource from 1.0.7 to 1.1.2 in /fixtures/blocks (#25385)
Bumps [eventsource](https://github.com/EventSource/eventsource) from 1.0.7 to 1.1.2.
- [Release notes](https://github.com/EventSource/eventsource/releases)
- [Changelog](https://github.com/EventSource/eventsource/blob/master/HISTORY.md)
- [Commits](https://github.com/EventSource/eventsource/compare/v1.0.7...v1.1.2)

---
updated-dependencies:
- dependency-name: eventsource
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-03 10:16:08 -04:00
Alexandru Tasica
21a851e035 Fix devtools typos and grammar (#24587)
Closes #24587
2022-10-03 10:11:40 -04:00
Kerim Büyükakyüz
cfafeb6858 Remove extra space in Wedge.js (#24611) 2022-10-03 10:03:56 -04:00
Jan Kassens
9c3de25e1c Flow: types first in reconciler (#25362)
This contains one code change, renaming the local function `ChildReconciler` to `createChildReconciler` as it's called as a function, not a constructor and to free up the name for the return value.
2022-10-01 18:47:32 -04:00
Sebastian Silbermann
0033d1a98c Fix failing tests in latest 16.x and 18.x Node versions (#25378) 2022-10-01 17:12:28 -04:00
Josh Story
7b25b961df [Fizz/Float] Float for stylesheet resources (#25243)
* [Fizz/Float] Float for stylesheet resources

This commit implements Float in Fizz and on the Client. The initial set of supported APIs is roughly

1. Convert certain stylesheets into style Resources when opting in with precedence prop
2. Emit preloads for stylesheets and explicit preload tags
3. Dedupe all Resources by href
4. Implement ReactDOM.preload() to allow for imperative preloading
5. Implement ReactDOM.preinit() to allow for imperative preinitialization

Currently supports
1. style Resources (link rel "stylesheet")
2. font Resources (preload as "font")

later updates will include support for scripts and modules
2022-09-30 16:14:04 -07:00
Jan Kassens
d061e6e7d4 CI: delete old AppVeyor config (#25373)
I noticed this file as #24892 is updating the NodeJS version in it.

I don't think this is used for anything as the config just runs a handful
of yarn commands and I assume that's all covered by CircleCI.
2022-09-30 19:02:25 -04:00
zhangrenyang
4c016e7aaf Refactor: use property shorthand (#25366) 2022-09-30 17:50:08 -04:00
Lauren Tan
06066c1a5a Make RulesOfHooks-test more consistent with ExhaustiveDeps-test
Small formatting changes to make the tests consistent.

ghstack-source-id: 7013a37f1f
Pull Request resolved: https://github.com/facebook/react/pull/25369
2022-09-30 15:16:22 -04:00
Lauren Tan
49ae0fad84 Fix RulesOfHooks test case indentation
Just a small formatting fix.

ghstack-source-id: c71ff02ed9
Pull Request resolved: https://github.com/facebook/react/pull/25368
2022-09-30 15:16:22 -04:00
Samuel Susla
abbbdf4cec Put modern StrictMode behind a feature flag (#25365)
* Put modern StrictMode behind a feature flag

* Remove unneeded flag
2022-09-30 17:06:11 +01:00
Igor Berlenko
434110390a ReactHooks.js - delete emptyObject (#25031)
It's not mentioned in docs and never used by projects.. should be removed..
2022-09-30 11:29:51 -04:00
jerry-lllman
31400ce293 Refactor: merge duplicate imports (#25364) 2022-09-30 09:57:50 -04:00
Lauren Tan
3517bd9f77 Refactor useEvent (#25336)
* Refactor useEvent

Previously, the useEvent implementation made use of effect infra under
the hood. This was a lot of extra overhead for functionality we didn't
use (events have no deps, and no clean up functions). This PR refactors
the implementation to instead use a queue to ensure that the callback is
stable across renders.

Additionally, the function signature was updated to infer the callback's argument types and return value. While this doesn't affect anything internal it more accurately describes what's being passed.
2022-09-29 13:45:27 -07:00
Jan Kassens
abd7bcd8b2 Flow: remove max_workers setting (#25349)
This was added back in #17880 to make CI pass for an unrelated change.

This limits the max worker setting to CI environments as removing the setting completely still seems to break on CircleCI.
2022-09-29 14:49:41 -04:00
Sreecharan
8ee4f52989 Fix: Documentation typos (#24471)
* fix: typo

Co-authored-by: Jan Kassens <jkassens@meta.com>
2022-09-29 12:46:53 -04:00
zhangenming
6cf06a9297 Remove outdated comments. (#24464)
fixed by https://github.com/facebook/react/pull/20894
2022-09-29 12:40:42 -04:00
Vic Graf
20a257c259 Refactor: more word doubles removed (#25352) 2022-09-29 09:57:49 -04:00
zhangrenyang
8cadcffd5d Fix typo: reconcilation -> reconciliation (#25355) 2022-09-29 09:34:30 -04:00
Sebastian Markbåge
ebbe599a25 Fix EventListener fork (#25347) 2022-09-28 19:45:59 -04:00
dependabot[bot]
904555eb64 Bump mout from 1.1.0 to 1.2.4 in /fixtures/packaging/brunch/dev (#25346)
Bumps [mout](https://github.com/mout/mout) from 1.1.0 to 1.2.4.
- [Release notes](https://github.com/mout/mout/releases)
- [Changelog](https://github.com/mout/mout/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mout/mout/compare/v1.1.0...v1.2.4)

---
updated-dependencies:
- dependency-name: mout
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-28 19:44:04 -04:00
Sebastian Markbåge
97d75c9c8b Move react-dom implementation files to react-dom-bindings (#25345)
This lets us share it with react-server-dom-webpack while still having a
dependency on react-dom. It also makes somewhat sense from a bundling
perspective since react-dom is an external to itself.
2022-09-28 19:05:50 -04:00
dan
3de9264496 [Fizz] experimental_useEvent (#25325)
* [Fizz] useEvent

* Use same message on client and server
2022-09-27 20:42:16 +01:00
Vic Graf
ae7ad8b4c2 refactor: removed duplicated words in comments (#25332) 2022-09-27 10:07:46 -04:00
Vic Graf
5b59dd6400 Fix duplicate words tests (#25333)
* refactor: removed duplicated words in comments
* refactor: removed duplicate words in tests
2022-09-27 10:07:06 -04:00
Lauren Tan
cb5084d1c4 [ESLint] Check useEvent references instead (#25319)
* [ESLint] Check useEvent references instead

Previously the useEvent check in RulesOfHooks would collect all
definitions of useEvent functions at the top level, record them as
violations, then clear those violations if the useEvent function was
later called or referened inside of an effect or another event.

The flaw with this approach was in the special case where useEvent
functions could be passed by reference inside of effects or events. The
violation would be cleared here (since it was called at least once)
and subsequent usages of the useEvent function would not be properly
checked.

This PR changes it so we check all identifiers that resolve to a
useEvent function, and if they are not in an effect or event must be
called or a lint error is emitted.

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>

* Add comment

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2022-09-24 01:34:17 +01:00
Lauren Tan
c89a83695c Update RulesOfHooks with useEvent rules (#25285)
This update to the RulesOfHooks rule checks that functions created with
`useEvent` can only be invoked in a `useEffect` callback, in another
event function, or a closure.
They can't be passed down directly as a reference to child components.

This PR also updates the ExhaustiveDeps lint rule to treat useEvent's 
return value as stable, so it can be omitted from dependency lists.

Currently this all gated behind an experimental flag.

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2022-09-23 14:55:12 -07:00
Josh Story
efc6a08e98 [Flight] Implement error digests for Flight runtime and expose errorInfo in getDerivedStateFromError (#25302)
Similar to Fizz, Flight now supports a return value from the user provided onError option. If a value is returned from onError it will be serialized and provided to the client.

The digest is stashed on the constructed Error on the client as .digest
2022-09-23 13:19:29 -07:00
Samuel Susla
c1d414d758 Add ref to Offscreen component (#25254)
* Expose ref to Offscreen if mode is manual

* Prepend private fields on OffscreenInstance with underscore

* Schedule Ref effect unconditionally on Offscreen

* Make sure Offscreen's ref is detached when unmounted

* Make sure ref is mounted/unmounted in all scenarious

* Nit: pendingProps -> memoizedProps

Co-authored-by: Andrew Clark <git@andrewclark.io>
2022-09-23 11:31:34 -04:00
Jan Kassens
135e33c954 Flow: typing of Scheduler (#25317)
Enables well formed exports for /scheduler. Some of the modules there were missing `@flow` and were therefore completely unchecked (despite some spurious types sprinkled around).
2022-09-23 10:28:34 -04:00
Jan Kassens
cc8cb145f0 Flow: add some missing types in react-reconciler (#25316)
To enable the next Flow version, we need to annotate exported values. This adds a few automatically inferred types that didn't look huge or just `any`.
2022-09-23 10:28:00 -04:00
Josh Story
112d0498c8 [Fizz] Move digest from errorInfo to Error instance (#25313)
* suspense boundary error digest to Error instance and deprecate digest from errorInfo for onRecoverableError

* fix closure escape
2022-09-22 12:40:30 -07:00
Andrew Clark
d1bb1c5861 Fix memory leak after repeated setState bailouts (#25309)
There's a global queue (`concurrentQueues` in the
ReactFiberConcurrentUpdates module) that is cleared at the beginning of
each render phase.

However, in the case of an eager `setState` bailout where the state is
updated to same value as the current one, we add the update to the queue
without scheduling a render. So the render phase never removes it from
the queue. This can lead to a memory leak if it happens repeatedly
without any other updates.

There's only one place where this ever happens, so the fix was pretty
straightforward.

Currently there's no great way to test this from a Jest test, so I
confirmed locally by checking in an existing test whether the array gets
reset. @sompylasar had an interesting suggestion for how to catch these
in the future: in the development build (perhaps behind a flag), use a
Babel plugin to instrument all module-level variables. Then periodically
sweep to confirm if something has leaked. The logic is that if there's
no React work scheduled, and a module-level variable points to an
object, it very likely indicates a memory leak.
2022-09-22 11:19:54 -04:00
Samuel Susla
0cac4d54c3 Double invoked effects on suspended children (#25307)
Co-authored-by: Robert Balicki <robertbalicki@fb.com>
2022-09-21 16:58:04 +01:00
Brandon Chan
b2748907c3 Updated the URL link for serve (#25296) 2022-09-19 13:13:38 -04:00
Victoria Graf
3d615fc14a Grammar. Removed doubles of the word "the". (#25295) 2022-09-19 10:04:03 -04:00
Tianyu Yao
e099e1dc0e React DevTools 4.25.0 -> 4.26.0 (#25283) 2022-09-16 12:35:00 -07:00
Tianyu Yao
6e3bc8a2e8 [DevTools] Check if Proxy exists before creating DispatcherProxy (#25278) 2022-09-16 11:24:03 -07:00
Tianyu Yao
8951c5fc9d [DevTools][BE] Read username using gh in release script (#25270)
* [DevTools][BE] Read username using gh in release script

* better regex & fix lint
2022-09-15 18:12:46 -07:00
Josh Story
e7fc04b297 [react-dom] Reorganize react-dom internals to match react (#25277)
* reorganize react-dom internals to match react

* refactor and make forks work for flow and internal imports

* flew too close to the sun

* typo
2022-09-15 15:31:31 -07:00
Jan Kassens
fc16293f3f Flow: well_formed_exports for devtools (#25266) 2022-09-15 16:45:29 -04:00