Commit Graph

13041 Commits

Author SHA1 Message Date
Nick Reiley
c083a643b1 Add <progress> to DOM fixtures (#18293)
* Add <progress> to DOM fixtures

* Remove uncontrolled
2020-04-03 14:39:59 +01:00
Sebastian Markbåge
3c16baf848 Remove /dist/ UMD builds (#18473)
* Remove /dist/ UMD builds

We publish UMDs to npm (and we're considering stopping even that).

This means we'll stop publishing to http://react.zpao.com/builds/master/latest/

* Update fixture paths
2020-04-02 17:52:32 -07:00
Dominic Gannaway
91c9d69f9a Modern Event System: Remove TestUtils.SimulateNative support (#18471) 2020-04-03 00:12:47 +01:00
Dan Abramov
e55855e7ae Deprecate TestUtils.SimulateNative (#13407) 2020-04-02 23:48:03 +01:00
Brian Vaughn
4123d729e5 Revert "Revert: Enable new passive effect behavior for FB builds (#18467)" (#18468)
This reverts commit 3966081cf2.
2020-04-02 15:24:36 -07:00
Dominic Gannaway
8815e4cc72 Cleanup getListener and EventSystemFlags (#18469) 2020-04-02 23:17:10 +01:00
Dominic Gannaway
5e464546af ReactDOM.useEvent: fix scope propagation issue (#18464) 2020-04-02 18:26:56 +01:00
Dominic Gannaway
d5e4b3ae1d Modern Event System: refine flags and handling of enableLegacyFBSupport (#18466) 2020-04-02 18:26:34 +01:00
Dominic Gannaway
3966081cf2 Revert: Enable new passive effect behavior for FB builds (#18467) 2020-04-02 16:25:35 +01:00
Dan Abramov
7dfdff42af Run more flags in VARIANT tests (#18461)
* Run more flags in VARIANT tests

* Revert enabling modern system

* Fix
2020-04-02 16:19:09 +01:00
Dan Abramov
31734540dc Remove a flag for style collision warning (#18462) 2020-04-02 11:55:17 +01:00
Dominic Gannaway
663c13d71d Refactor Enter/Leave listener accumulation (#18405)
* Refactor Enter/Leave listener accumulation
2020-04-02 11:07:20 +01:00
Dan Abramov
c80cd8ee27 Revert "Fix email cursor jump (#18379)" (#18459)
* Revert "Fix email cursor jump (#18379)"

This reverts commit 9b88b78b3d.

* Leave fixtures be
2020-04-01 22:44:59 +01:00
Andrew Clark
58afba0663 Fix: Don't read primaryChild.childExpirationTime (#18457)
This is a variant of the fix in 5a0f1d. We can't rely on the primary
fiber's `childExpirationTime` field to be correct.

In this case, we can read from the Suspense boundary fiber instead.
This will include updates that exist in the fallback fiber, but that's
not a big deal; the important thing is that we don't drop updates.
2020-04-01 14:36:42 -07:00
Brian Vaughn
2ea7c60794 Fixed race condition in release script (#18456) 2020-04-01 14:17:55 -07:00
Dan Abramov
99d779f629 Don't close "Needs Investigation" issues (#18458) 2020-04-01 22:08:09 +01:00
Gabriel McAdams
3f46844899 [eslint-plugin-react-hooks] Added meta property (including docs) (#16607)
* [eslint-plugin-react-hooks] Added meta property (including docs)

* [eslint-plugin-react-hooks] Fixed typo (`RuleOfHooks` -> `RulesOfHooks`)

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-04-01 21:13:10 +01:00
Dan Abramov
2bf60d9f9c Fix ESLint rule crash (#18455) 2020-04-01 20:54:42 +01:00
Sebastian Markbåge
3e94bce765 Enable prefer-const lint rules (#18451)
* Enable prefer-const rule

Stylistically I don't like this but Closure Compiler takes advantage of
this information.

* Auto-fix lints

* Manually fix the remaining callsites
2020-04-01 12:35:52 -07:00
Sebastian Markbåge
e6ea3d3873 Use Closure Compiler to compile to ES5 instead of Babel (#18449)
* Upgrade Closure

There are newer versions but they don't yet have corresponding releases
of google-closure-compiler-osx.

* Configure build

* Refactor ReactSymbols a bit

Provides a little better output.
2020-04-01 12:08:37 -07:00
Utkarsh Kukreti
5200547100 Do not warn when a controlled input has onInput handler. (#18189)
`onInput` behaves the same as `onChange` for controlled inputs as far as I
know, so React should not print the following warning when `onInput` is
present.

> Failed prop type: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.
2020-04-01 19:58:07 +01:00
Sebastian Silbermann
7516bdfce3 feat(createContext): Include displayName in warning (#18386) 2020-04-01 19:42:38 +01:00
Nick Reiley
9b88b78b3d Fix email cursor jump (#18379)
* add email input fixture to show cursor jump

* fix cursor jump in email input

Co-authored-by: Peter Potapov <dr.potapoff-peter@yandex.ru>

* add regression tests to ensure attributes are working

Co-authored-by: Peter Potapov <dr.potapoff-peter@yandex.ru>
2020-04-01 19:30:26 +01:00
Brian Vaughn
5ee0efe832 Remove state update warning for passive effect cleanup functions (#18453) 2020-04-01 10:49:24 -07:00
Dan Abramov
d8d2b6e89c Disable module components dynamically for WWW (#18446)
* Make disableModulePatternComponents dynamic for WWW

* Run both flags and tests and respect the flag in SSR
2020-04-01 18:31:59 +01:00
Sebastian Markbåge
e2c6702fca Remove ConcurrentMode and AsyncMode symbols (#18450)
This API was never released.
2020-04-01 10:18:52 -07:00
Dominic Gannaway
d6d5f5aabe Move accumulateEventTargetListeners to its own module/function (#18407) 2020-04-01 14:19:21 +01:00
Dominic Gannaway
dc3c6c9565 ReactDOM.useEvent: revert and add guard for null stateNode (#18441) 2020-04-01 12:45:26 +01:00
Sebastian Markbåge
0f334553c9 Reset stateNode in resetWorkInProgress (#18448)
* test(SuspenseList): Add failing test for class component

* Reset stateNode when resetWorkInProgress

This is supposed to put the Fiber into the same state as if it was just
created by child fiber reconciliation. For newly created fibers, that means
that stateNode is null.

Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
2020-03-31 21:14:59 -07:00
Brian Vaughn
153b5c305d Cleanup previous shims directories before re-copying (#18447) 2020-03-31 12:22:02 -07:00
Brian Vaughn
4de3a60325 Remove disableMapsAsChildren flag (#18445)
Change warning to say the case is unsupported (not "will be deprecated")
2020-03-31 11:00:51 -07:00
Brian Vaughn
f4cc970276 Enable new passive effect behavior for FB builds (#18444)
* Enable new passive effect behavior for FB builds

Previously this behavior was controlled by GKs. This PR updates the flags to be enabled statically. It also enables the flags in the test builds.
2020-03-31 10:05:15 -07:00
Dan Abramov
9065e02d66 Fix a warning typo (#18443) 2020-03-31 15:55:30 +01:00
Dan Abramov
1960131f11 Add opt-in support for dangerous autofix (#18437) 2020-03-31 11:43:01 +01:00
Andrew Clark
90e90ac8e0 Revert useEvent PRs (#18438)
* Revert "ReactDOM.useEvent: enable on internal www and add inspection test (#18395)"

This reverts commit e0ab1a429d.

* Revert "ReactDOM.useEvent: Add support for experimental scopes API (#18375)"

This reverts commit a16b349745.

* ReactDOM.useEvent: Add support for experimental scopes API
2020-03-30 19:16:28 -07:00
Dan Abramov
da54641a10 [ESLint] Check deps when callback body is outside the Hook call, too (#18435)
* Refactor: visit CallExpression

Instead of visiting the functions and looking up to see if they're in a Hook call, visit Hook calls and look down to see if there's a callback inside. I will need this refactor so I can visit functions declared outside the call.

* Check deps when callback body is outside the Hook call

* Handle the unknown case
2020-03-31 02:09:32 +01:00
Dan Abramov
bf30e370a5 Remove User Timings (#18417) 2020-03-31 00:29:53 +01:00
Ricky
dd7e5e4f5a Add getInspectorDataForViewAtPoint (take two) (#18388)
* Add getInspectorDataForViewAtPoint (take two)

* Updates from review

* Add DEV to dev-only variable

* Missed this rename
2020-03-30 15:42:41 -04:00
Andrew Clark
d7382b6c43 Bugfix: Do not unhide a suspended tree without finishing the suspended update (#18411)
* Bugfix: Suspended update must finish to unhide

When we commit a fallback, we cannot unhide the content without including
the level that originally suspended. That's because the work at level
outside the boundary (i.e. everything that wasn't hidden during that
render) already committed.

* Test unblocking with a high-pri update
v0.0.0-d7382b6c4 v0.0.0-experimental-d7382b6c4
2020-03-30 11:25:04 -07:00
Dan Abramov
1f8c40451a Make interaction tracing on by default in all WWW builds (#18419) 2020-03-30 16:07:58 +01:00
Sebastian Silbermann
ba31ad40a9 feat(StrictMode): Double-invoke render for every component (#18430)
* feat(StrictMode): Double-invoke render for every component

* fix: Mark ReactTestRendererAsync as internal
2020-03-29 23:13:46 +01:00
Sebastian Markbåge
689d27586e Reset lastEffect when resuming SuspenseList (#18412)
We store an effect pointer so we can backtrack in the effect list in some
cases. This is a stateful variable. If we interrupt a render we need to
reset it.

This field was added after the optimization was added and I didn't remember
to reset it here.

Otherwise we end up not resetting the firstEffect so it points to a stale
list. As a result children don't end up inserted like we think they were.
Then we try to remove them it errors.

It would be nicer to just get rid of the effect list and use the tree for
effects instead. Maybe we still need something for deletions tho.
2020-03-29 10:13:17 -07:00
Rodrigo Graça
1af2a10891 https link to editorconfig.org (#18421) 2020-03-29 15:18:52 +01:00
zefeng
d7918f4a9b chore: npm link more directly (#18428) 2020-03-29 15:18:15 +01:00
Brian Vaughn
be4c8b19c1 Don't show destroy function state update warning when updating ancestors (#18409)
React can't directly detect a memory leak, but there are some clues that warn about one. One of these clues is when an unmounted React component tries to update its state. For example, if a component forgets to remove an event listener when unmounting, that listener may be called later and try to update state, at which point React would warn about the potential leak.

Warning signals like this are more useful if they're strong. For this reason, it's good to always avoid updating state from inside of an effect's cleanup function. Even when you know there is no potential leak, React has no way to know and so it will warn anyway.

In most cases we suggest moving state updates to the useEffect() body instead (to avoid triggering the warning). This works so long as the component is updating its own state (or the state of a descendant). However this will not work when a component updates its parent state in a cleanup function. If such a component is unmounted but its parent remains mounted, the state will be incorrect. For this reason, we now avoid showing the warning if a component is updating an ancestor.
2020-03-28 10:18:14 -07:00
Andrew Clark
35a2f74974 Delete leftover assignment from #18384
This assignment should have been deleted in #18384. It was deleted in
the other branches, but I missed this one. About to open a PR that
includes a test that covers this branch.
2020-03-27 15:17:30 -07:00
Andrew Clark
9d67847f7b [Bugfix] Dropped updates inside a suspended tree (#18384)
* Minor test refactor: `resolveText`

Adds a `resolveText` method as an alternative to using timers. Also
removes dependency on react-cache (for just this one test file; can do
the others later).

Timer option is still there if you provide a `ms` prop.

* Bugfix: Dropped updates in suspended tree

When there are multiple updates at different priority levels inside
a suspended subtree, all but the highest priority one is dropped after
the highest one suspends.

We do have tests that cover this for updates that originate outside of
the Suspense boundary, but not for updates that originate inside.

I'm surprised it's taken us this long to find this issue, but it makes
sense in that transition updates usually originate outside the boundary
or "seam" of the part of the UI that is transitioning.

* Bugfix: Suspense fragment skipped by setState

Fixes a bug where updates inside a suspended tree are dropped because
the fragment fiber we insert to wrap the hidden children is not part of
the return path, so it doesn't get marked during setState.

As a workaround, I recompute `childExpirationTime` right before deciding
to bail out by bubbling it up from the next level of children.

This is something we should consider addressing when we refactor the
Fiber data structure.

* Add back `lastPendingTime` field

This reverts commit 9a541139dfe36e8b9b02b1c6585889e2abf97389.

I want to use this so we can check if there might be any lower priority
updates in a suspended tree.

We can remove it again during the expiration times refactor.

* Use `lastPendingTime` instead of Idle

We don't currently have an mechanism to check if there are lower
priority updates in a subtree, but we can check if there are any in the
whole root. This still isn't perfect but it's better than using Idle,
which frequently leads to redundant re-renders.

When we refactor `expirationTime` to be a bitmask, this will no longer
be necessary because we'll know exactly which "task bits" remain.

* Add a test for updating the fallback
2020-03-26 11:31:40 -07:00
Dan Abramov
5bd1bc29b3 eslint-plugin-react-hooks@3.0.0 2020-03-26 17:59:25 +00:00
Dominic Gannaway
e0ab1a429d ReactDOM.useEvent: enable on internal www and add inspection test (#18395) 2020-03-26 17:13:05 +00:00
Brian Vaughn
6cceaeb67a DevTools v4.5.0 -> 4.6.0 2020-03-26 10:00:37 -07:00