Commit Graph

1665 Commits

Author SHA1 Message Date
Jan Kassens ea5bc6bac1
[React Native FB] dynamic feature flag for ref access warning (#25471) 2022-10-14 10:11:42 -04:00
Sebastian Markbåge 08d035bc8f
Remove Shallow Renderer Tests (#25475) 2022-10-13 19:02:03 -04:00
Sebastian Markbåge a8c16a0040
Split Cache into its own Dispatcher (#25474)
* Missing Hooks

* Remove www forks. These can use __SECRET... instead.

* Move cache to separate dispatcher

These will be available in more contexts than just render.
2022-10-12 23:13:39 -04:00
Josh Story 2cf4352e1c
Implement HostSingleton Fiber type (#25426) 2022-10-11 08:42:42 -07:00
Josh Story aa9988e5e6
Server render fork for react-dom (#25436)
Publish an aliasable entry for `react-dom` top level package exports for use in server environments. This is a stub containing only the exports that we expect to retain in the top level once 19 is released
2022-10-10 11:06:22 -07:00
Josh Story 2872a26e14
track resources in different roots separately (#25388)
* track resources in different roots separately

* flow types

* add test demonstrating portals deep into shadowRoots

* revert hostcontext changes

* lints

* funge style cache key a la ReactDOMComponentTree

* hide hacks in componentTree
2022-10-04 16:11:15 -07:00
Jan Kassens 9813edef29 Flow upgrade to 0.188
ghstack-source-id: 5c359b97cc
Pull Request resolved: https://github.com/facebook/react/pull/25423
2022-10-04 15:49:48 -04:00
Jan Kassens 3b6826ed9e Flow: inference_mode=constrain_writes
This mode is going to be the new default in Flow going forward.
There was an unfortuante large number of suppressions in this update.

More on the changes can be found in this [Flow blog post](https://medium.com/flow-type/new-flow-language-rule-constrained-writes-4c70e375d190).

Added some of the required annotations using the provided codemod:

```sh
node_modules/.bin/flow codemod annotate-declarations --write .
```

ghstack-source-id: 0b168e1b23
Pull Request resolved: https://github.com/facebook/react/pull/25422
2022-10-04 15:49:48 -04:00
lauren af9afe9b3f
Update safe-string-coercion to handle additions of string literals (#25286)
* Update safe-string-coercion to handle additions of string literals

Adding strings shouldn't trigger a lint violation of this rule, since
adding strings are always safe.
2022-10-04 12:29:36 -07:00
Jan Kassens aed33a49cc Flow upgrade to 0.185
ghstack-source-id: 8104710c96
Pull Request resolved: https://github.com/facebook/react/pull/25420
2022-10-04 13:50:59 -04:00
Jan Kassens f02a5f5c79 Flow upgrade to 0.182
ghstack-source-id: b9bb8c1560
Pull Request resolved: https://github.com/facebook/react/pull/25419
2022-10-04 13:37:58 -04:00
Jan Kassens 72593f008e Flow upgrade to 0.176
This upgrade deprecated calling `new` on functions which introduced
the majority of breakages and I suppressed those.

ghstack-source-id: 545363f3c5
Pull Request resolved: https://github.com/facebook/react/pull/25418
2022-10-04 13:37:58 -04:00
Jan Kassens 46d40f306a Flow upgrade to 0.175
ghstack-source-id: 99008118ef
Pull Request resolved: https://github.com/facebook/react/pull/25417
2022-10-04 13:37:58 -04:00
Jan Kassens 338e6a967c Flow upgrade to 0.155
This version banned use of this in object functions.

ghstack-source-id: f49fd5e1b7
Pull Request resolved: https://github.com/facebook/react/pull/25414
2022-10-04 11:49:15 -04:00
Jan Kassens 8bc95bb3c8 Flow upgrade to 0.154
ghstack-source-id: d84024950a
Pull Request resolved: https://github.com/facebook/react/pull/25413
2022-10-04 11:49:14 -04:00
Jan Kassens 9f8a98a390 Flow upgrade to 0.153
- method unbinding is no longer supported in Flow for soundness, this added a bunch of suppressions
- Flow now prevents objects to be supertypes of interfaces/classes

ghstack-source-id: d7749cbad8
Pull Request resolved: https://github.com/facebook/react/pull/25412
2022-10-04 11:30:06 -04:00
Jan Kassens adb58f529d Flow upgrade to 0.152
- 0.147 removes access to Object.prototype via the global object.
- 0.149 removed deprecated config options

ghstack-source-id: c77f9b3739
Pull Request resolved: https://github.com/facebook/react/pull/25411
2022-10-04 11:30:06 -04:00
Jan Kassens 64fe791be8 Flow upgrade to 0.146
This upgrade made more expressions invalidate refinements. In some
places this lead to a large number of suppressions that I automatically
suppressed and should be followed up on when the code is touched.
I think most of them might require either manual annotations or moving
a value into a const to allow refinement.

ghstack-source-id: a45b40abf0
Pull Request resolved: https://github.com/facebook/react/pull/25410
2022-10-04 11:01:50 -04:00
Jan Kassens d3c6c16a03 Flow upgrade to 0.145
Fixed a RN library definition that defined `CustomEvent` as a reference to itself.

ghstack-source-id: 90da2e316f
Pull Request resolved: https://github.com/facebook/react/pull/25409
2022-10-04 11:01:50 -04:00
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 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 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
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 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
Vic Graf 20a257c259
Refactor: more word doubles removed (#25352) 2022-09-29 09:57:49 -04:00
Sebastian Markbåge ebbe599a25
Fix EventListener fork (#25347) 2022-09-28 19:45:59 -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
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
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
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
Sebastian Markbåge 60fbb7b143
[Flight] Implement FlightClient in terms of Thenable/Promises instead of throwing Promises (#25260)
* [Flight] Align Chunks with Thenable used with experimental_use

Use the field names used by the Thenable data structure passed to use().
These are considered public in this model.

This adds another field since we use a separate field name for "reason".

* Implement Thenable Protocol on Chunks

This doesn't just ping but resolves/rejects with the value.

* Subclass Promises

* Pass key through JSON parsing

* Wait for preloadModules before resolving module chunks

* Initialize lazy resolved values before reading the result

* Block a model from initializing if its direct dependencies are pending

If a module is blocked, then we can't complete initializing a model.
However, we can still let it parse, and then fill in the missing pieces
later.

We need to block it from resolving until all dependencies have filled in
which we can do with a ref count.

* Treat blocked modules or models as a special status

We currently loop over all chunks at the end to error them if they're
still pending. We shouldn't do this if they're pending because they're
blocked on an external resource like a module because the module might not
resolve before the Flight connection closes and that's not an error.

In an alternative solution I had a set that tracked pending chunks and
removed one at a time. While the loop at the end is faster it's more
work as we go.

I figured the extra status might also help debugging.

For modules we can probably assume no forward references, and the first
async module we can just use the promise as the chunk.

So we could probably get away with this only on models that are blocked by
modules.
2022-09-14 20:13:33 -04:00
Lauren Tan c91a1e03be
experimental_useEvent (#25229)
This commit adds a new hook `useEvent` per the RFC [here](https://github.com/reactjs/rfcs/pull/220), gated as experimental. 

Co-authored-by: Rick Hanlon <rickhanlonii@gmail.com>
Co-authored-by: Rick Hanlon <rickhanlonii@fb.com>
Co-authored-by: Lauren Tan <poteto@users.noreply.github.com>
2022-09-14 11:39:06 -07:00
Jan Kassens afe664d9d7
Flow: upgrade to 0.142 (#25255) 2022-09-13 18:39:26 -04:00
Jan Kassens 5fdcd23aaa
Flow: upgrade to 0.140 (#25252)
This update range includes:

- `types_first` ([blog](https://flow.org/en/docs/lang/types-first/), all exports need annotated types) is default. I disabled this for now to make that change incremental.
- Generics that escape the scope they are defined in are an error. I fixed some with explicit type annotations and some are suppressed that I didn't easily figure out.
2022-09-13 13:33:43 -04:00
Jan Kassens 6aa38e74c7
Flow: enable unsafe-addition error (#25242) 2022-09-12 16:22:50 -04:00
Jan Kassens ba7b6f4183
Flow: upgrade to 0.132 (#25244) 2022-09-12 14:36:02 -04:00
Jan Kassens 9328988c02
Flow: fix Fiber typed as any (#25241) 2022-09-12 13:44:58 -04:00
Jan Kassens d5ddc6543e
Flow: upgrade to 0.131 (#25224)
This also downgrades the new lint warning to avoid new suppressions with this upgrade.
2022-09-09 16:21:32 -04:00
Jan Kassens 8003ab9cf5
Flow: remove explicit object syntax (#25223) 2022-09-09 16:03:48 -04:00
Jan Kassens 492c6e29e7
Flow: upgrade to 0.127 (#25221)
A smaller incremental update as some next version was changing more.
2022-09-09 12:21:44 -04:00
Jan Kassens bbd56b278c
Flow: enable exact_by_default (#25220)
With this change, a simple object type `{ }` means an exact object `{| |}` which most people assume.
Opting for inexact requires the extra `{ a: number, ... }` syntax at the end.

A followup, someone could replace all the `{| |}` with `{ }`.
2022-09-09 12:16:40 -04:00
Jan Kassens 8a9e7b6cef
Flow: implicit-inexact-object=error (#25210)
* implicit-inexact-object=error
* default everything ambiguous to exact object
* inexact where exact causes errors
2022-09-09 10:13:58 -04:00
Jan Kassens a473d08fce
Update to Flow from 0.97 to 0.122 (#25204)
* flow 0.122
* update ReactModel type
2022-09-08 11:46:07 -04:00
Jan Kassens f0efa1164b
[flow] remove custom suppress comment config (#25170) 2022-09-01 12:55:59 -04:00