Commit Graph

13386 Commits

Author SHA1 Message Date
Sebastian Silbermann
e2d73e91cc chore: Build react-dom/test-utils in codesandbox deploy (#19321) 2020-07-13 16:15:37 +01:00
Dominic Gannaway
61dd00db24 Extract some of the tidy up changes from 19278 (#19315) 2020-07-10 22:33:42 +01:00
Dan Abramov
a2b4db05bc eslint-plugin-react-hooks@4.0.7 2020-07-10 19:08:05 +01:00
Dan Abramov
47915fd6e1 [ESLint] Fix a bug causing a too coarse dependency suggestion (#19313)
* Add regression test for ESLint rule

* Fix the issue
2020-07-10 19:02:08 +01:00
Brian Vaughn
d5d659062d Updated DevTools test snapshots 2020-07-10 13:06:50 -04:00
Dominic Gannaway
2562e758ea Revise useFocus/useFocusWithin (#19310) 2020-07-10 17:23:00 +01:00
Nick Reiley
17efbf7d63 [DevTools] Show HOC names in profiler (#19283)
* show hoc names in profiler

* Added hocDisplayNames.length check

Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-07-10 11:21:19 -04:00
Andrew Clark
970fa122d8 Use lanes to check if a render is a Suspense retry (#19307)
Now that Suspense retries have their own dedicated set of lanes
(#19287), we can determine if a render includes only retries by checking
if its lanes are a subset of the retry lanes.

Previously we inferred this by checking
`workInProgressRootLatestProcessedEventTime`. If it's not set, that
implies that no updates were processed in the current render, which
implies it must be a Suspense retry. The eventual plan is to get rid of
`workInProgressRootLatestProcessedEventTime` and instead track event
times on the root; this change is one the steps toward that goal.

The relevant tests were originally added in #15769.
2020-07-10 08:58:05 -05:00
Dan Abramov
2663a12eb3 Tweak wording 2020-07-10 14:56:28 +01:00
Dan Abramov
d4eadea6c7 React DevTools 4.8.1 2020-07-10 14:11:55 +01:00
Dan Abramov
8eaf05e0e8 DevTools: Make break-on-warn off by default (#19309) 2020-07-10 14:11:32 +01:00
Andrew Clark
14084be286 Refactor algorithm for next Lanes to work on (#19302)
Some clean up to make the Lanes type easier to maintain.

I removed the "start" and "end" range markers; they don't provide any
information that isn't already encoded in the bitmask for each range,
and there's no computation saved compared to the
`pickArbitraryLane` function.

The overall algorithm is largely the same but I did tweak some of the
details. For example, if the lanes for a given priority are already
being worked on, the previous algorithm would assign to the next
available lane, including the dedicated hydration lanes that exist
in between each priority.

The updated algorithm skips over the hydration lanes and goes to the
next priority level. In the rare instance when all the non-Idle update
lanes are occupied, it will pick an abitrary default lane. This will
have the effect of invalidating the current work-in-progress, and
indicates a starvation scenario.

Eventually, if there are too many interruptions, the expiration time
mechanism will kick in and force the update to synchronously finish.
2020-07-09 18:53:54 -05:00
Brian Vaughn
08b8e6e1dc DevTools 4.7.0 -> 4.8.0 (#19297) 2020-07-09 10:49:44 -04:00
Brian Vaughn
e760d1fb0f Fixed test script for DevTools build config (#19295) 2020-07-09 10:49:33 -04:00
Gianmarco
a5b4492950 Updates Electron version for react-devtools (#19280) 2020-07-09 10:13:26 -04:00
Rimil Dey
6508ab3be8 Fix typo in Overview doc for react-devtools (#19289) 2020-07-09 09:13:15 -04:00
Andrew Clark
965d08cfff Add dedicated LanePriority for Suspense retries (#19287)
A "retry" is a special type of update that attempts to flip a Suspense
boundary from its placeholder state back to its primary/resolved state.

Currently, retries are given default priority, using the same algorithm
as normal updates and occupying range of lanes.

This adds a new range of lanes dedicated specifically to retries, and
gives them lower priority than normal updates.

A couple of existing tests were affected because retries are no longer
batched with normal updates; they commit in separate batches.

Not totally satisfied with this design, but I think things will snap more
into place once the rest of the Lanes changes (like how we handle
parallel Suspense transitions) have settled.
2020-07-08 21:09:22 -07:00
Dominic Gannaway
766af5968a Move Scope API ref resolution to mutation phase (#19264)
* Move Scope API ref resolution to mutation phase
2020-07-08 23:41:39 +01:00
Dan Abramov
c7805b8d57 Use a custom jsdom fork (#19284) 2020-07-08 21:26:54 +01:00
Dan Abramov
e0e6b9c036 Add regression test for #19269 (#19282) 2020-07-08 20:48:43 +01:00
Behnam Mohammadi
77e872217c Improve readability of isValidElementType (#19251)
* improve readability

* replace condition by switch/case

* replace condition by switch/case

* remove unnecessary braces

* replace switch/case to ifs

* replace switch/case to ifs

* fix by multiline if statements

* fix multiple if statements
2020-07-08 19:25:24 +01:00
Dan Abramov
7b0ef42bcc Update README.md 2020-07-08 18:30:18 +01:00
Giovanni Fumagalli
d87220f217 Add console group methods to dev disabled groups (#19069)
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-07-08 17:28:49 +01:00
Dominic Gannaway
f5ea39c182 Modern Event System: make on*Capture events use capture phase (#19221) 2020-07-08 17:10:06 +01:00
falguniraina
e18fb91852 Text improvement (#19167)
text improvement in README.md
2020-07-08 17:07:27 +01:00
E-Liang Tan
40cddfeeb1 Add user timing marks for scheduling profiler tool (#19223)
High level breakdown of this commit:

* Add a enableSchedulingProfiling feature flag.
* Add functions that call User Timing APIs to a new SchedulingProfiler file. The file follows DebugTracing's structure.
* Add user timing marks to places where DebugTracing logs.
* Add user timing marks to most other places where @bvaughn's original draft DebugTracing branch marks.
* Tests added
* More context (and discussions with @bvaughn) available at our internal PR MLH-Fellowship#11 and issue MLH-Fellowship#5.

Similar to DebugTracing, we've only added scheduling profiling calls to the old reconciler fork.

Co-authored-by: Kartik Choudhary <kartik.c918@gmail.com>
Co-authored-by: Kartik Choudhary <kartikc.918@gmail.com>
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-07-08 10:36:02 -04:00
Phil MacCart
b85b47630b Fix state leaking when a function component throws on server render (#19212)
* add unit test asserting internal hooks state is reset

* Reset internal hooks state before rendering

* reset hooks state on error

* Use expect...toThrow instead of try/catch in test

* reset dev-only hooks state inside resetHooksState

* reset currentlyRenderingComponent to null
2020-07-08 03:10:23 +01:00
Dan Abramov
6fd4321135 eslint-plugin-react-hooks@4.0.6 2020-07-07 22:39:40 +01:00
Dan Abramov
7c35cb20ef [ESLint] Handle optional member chains (#19275)
* Rename internal variables

This disambiguates "optional"/"required" because that terminology is taken by optional chaining.

* Handle optional member chains

* Update comment

Co-authored-by: Ricky <rickhanlonii@gmail.com>

Co-authored-by: Ricky <rickhanlonii@gmail.com>
2020-07-07 21:34:16 +01:00
Ricky
dccf541ec5 Allow decoupleUpdatePriorityFromScheduler to be set (#19272) 2020-07-07 12:58:10 -04:00
Dan Abramov
7ca1d861e8 [ESLint] Consistently treat optional chaining as regular chaining (#19273)
* Revert "Fix ExhaustiveDeps ESLint rule throwing with optional chaining (#19260)"

This reverts commit 0f84b0f02b.

* Re-add a test from #19260

* Remove all code for optional chaining support

* Consistently treat optional chaining as regular chaining

This is not ideal because our suggestions use normal chaining. But it gets rid of all current edge cases.

* Add more tests

* More consistency in treating normal and optional expressions

* Add regression tests for every occurrence of Optional*
2020-07-07 17:38:44 +01:00
Dominic Gannaway
98390f11f6 Update useEvent implementation (#19271) 2020-07-07 14:44:56 +01:00
Dominic Gannaway
4eb9b1d2b4 Refactor createEventHandle signature (#19174) 2020-07-07 13:05:06 +01:00
Dominic Gannaway
97b96da295 Fix event replaying logic (#19269) 2020-07-07 02:28:55 +01:00
Ricky
91a2e8173f Decouple update priority tracking from Scheduler package (#19121)
* Initial currentLanePriority implementation

* Minor updates from review

* Fix typos and enable flag

* Fix feature flags and lint

* Fix simple event tests by switching to withSuspenseConfig

* Don't lower the priority of setPending in startTransition below InputContinuous

* Move currentUpdateLanePriority in commit root into the first effect block

* Refactor requestUpdateLane to log for priority mismatches

Also verifies that the update lane priority matches the scheduler lane priority before using it

* Fix four tests by adding ReactDOM.unstable_runWithPriority

* Fix partial hydration when using update lane priority

* Fix partial hydration when using update lane priority

* Rename feature flag and only log for now

* Move unstable_runWithPriority to ReactFiberReconciler

* Add unstable_runWithPriority to ReactNoopPersistent too

* Bug fixes and performance improvements

* Initial currentLanePriority implementation

* Minor updates from review

* Fix typos and enable flag

* Remove higherLanePriority from ReactDOMEventReplaying.js

* Change warning implementation and startTransition update lane priority

* Inject reconciler functions to avoid importing src/

* Fix feature flags and lint

* Fix simple event tests by switching to withSuspenseConfig

* Don't lower the priority of setPending in startTransition below InputContinuous

* Move currentUpdateLanePriority in commit root into the first effect block

* Refactor requestUpdateLane to log for priority mismatches

Also verifies that the update lane priority matches the scheduler lane priority before using it

* Fix four tests by adding ReactDOM.unstable_runWithPriority

* Fix partial hydration when using update lane priority

* Fix partial hydration when using update lane priority

* Rename feature flag and only log for now

* Move unstable_runWithPriority to ReactFiberReconciler

* Bug fixes and performance improvements

* Remove higherLanePriority from ReactDOMEventReplaying.js

* Change warning implementation and startTransition update lane priority

* Inject reconciler functions to avoid importing src/

* Fixes from bad rebase
2020-07-06 18:53:42 -04:00
Dominic Gannaway
c3e42a962b Fix master tests (#19267) 2020-07-06 17:36:19 -04:00
Dominic Gannaway
0c0aaeb6bc Handle test-cli failure case for CI (#19265) 2020-07-06 22:05:51 +01:00
Joe Lencioni
0f84b0f02b Fix ExhaustiveDeps ESLint rule throwing with optional chaining (#19260)
Certain code patterns using optional chaining syntax causes
eslint-plugin-react-hooks to throw an error.

We can avoid the throw by adding some guards. I didn't read through the
code to understand how it works, I just added a guard to every place
where it threw, so maybe there is a better fix closer to the root cause
than what I have here.

In my test case, I noticed that the optional chaining that was used in
the code was not included in the suggestions description or output,
but it seems like it should be. This might make a nice future
improvement on top of this fix, so I left a TODO comment to that effect.

Fixes #19243
2020-07-06 15:52:14 -04:00
Brian Vaughn
670c0376ea Enable createEventHandle API for wWW test builds (#19262) 2020-07-06 15:19:50 -04:00
Dominic Gannaway
26071abbe1 Refine event registration + event signatures (#19244)
* Refine event registration + event signatures

* Address feedback
2020-07-06 17:42:01 +01:00
Ittai Baratz
1cbaf48889 Add SSL support to React devtools standalone (#19191)
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-07-06 10:09:41 -04:00
Dominic Gannaway
65c137768a Fix Flow from #19239 (#19242) 2020-07-02 16:37:10 +01:00
Son Ki-Kyun
cd9046f815 Add some type detection (#19239) 2020-07-02 15:54:36 +01:00
Dan Abramov
b6df4417c7 Remove event config (#19237) 2020-07-02 00:26:29 +01:00
Dan Abramov
991c3b8193 Make event config an implementation detail of each plugin (#19236)
* Merge two variables with same purpose

* Replace dispatchConfig with _reactName on event object
2020-07-02 00:03:17 +01:00
Dan Abramov
b683c07ccc Remove TestUtils dependency on event registry (#19235) 2020-07-01 22:54:28 +01:00
Dan Abramov
9e7f5c02ca Make event plugin injection statically resolvable (#19234)
* Make plugins ESM

* Resolve extractEvents statically

* Resolve eventTypes statically

* Fix flow types and inconsistent naming

* Move injection into the plugin system itself

* Fix Flow
2020-07-01 22:11:05 +01:00
Dominic Gannaway
67eb6ff4a8 Add Flow to ModernChangeEventPlugin (#19232) 2020-07-01 21:49:03 +01:00
Dan Abramov
75b6921d64 Remove dead code from modern event system (#19233)
* Remove dead code from modern event system

* Remove SSR dependency on EventPluginRegistry
2020-07-01 21:04:14 +01:00
Dan Abramov
9fba65efa5 Enable modern event system and delete dead code (#19230) 2020-07-01 17:43:34 +01:00