Commit Graph
2695 Commits
Author SHA1 Message Date
Dan Abramov 549d613298 Tweak wording 2020-07-10 14:56:28 +01:00
Dan Abramov 270e46cfcd React DevTools 4.8.1 2020-07-10 14:11:55 +01:00
Dan AbramovandGitHub ff7bec5200 DevTools: Make break-on-warn off by default (#19309) 2020-07-10 14:11:32 +01:00
Andrew ClarkandGitHub 4a2f72b13c 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 VaughnandGitHub 1a46464a0e DevTools 4.7.0 -> 4.8.0 (#19297) 2020-07-09 10:49:44 -04:00
GianmarcoandGitHub 0a407b41bf Updates Electron version for react-devtools (#19280) 2020-07-09 10:13:26 -04:00
Rimil DeyandGitHub f52932add7 Fix typo in Overview doc for react-devtools (#19289) 2020-07-09 09:13:15 -04:00
Andrew ClarkandGitHub 4e9a1d82ea 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 GannawayandGitHub 126e05f72e 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 AbramovandGitHub feb9fd5f72 Add regression test for #19269 (#19282) 2020-07-08 20:48:43 +01:00
Behnam MohammadiandGitHub 5d43047a9e 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
ca41aa8d1a Add console group methods to dev disabled groups (#19069)
Co-authored-by: Dan Abramov <[email protected]>
2020-07-08 17:28:49 +01:00
Dominic GannawayandGitHub d5d49fc5c7 Modern Event System: make on*Capture events use capture phase (#19221) 2020-07-08 17:10:06 +01:00
2ac6101ef9 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 <[email protected]>
Co-authored-by: Kartik Choudhary <[email protected]>
Co-authored-by: Brian Vaughn <[email protected]>
2020-07-08 10:36:02 -04:00
Phil MacCartandGitHub b4f519ebb7 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 ff283971ae [email protected] 2020-07-07 22:39:40 +01:00
e249c1cf4f [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 <[email protected]>

Co-authored-by: Ricky <[email protected]>
2020-07-07 21:34:16 +01:00
RickyandGitHub 6b21ed02fb Allow decoupleUpdatePriorityFromScheduler to be set (#19272) 2020-07-07 12:58:10 -04:00
Dan AbramovandGitHub 9e528acaaa [ESLint] Consistently treat optional chaining as regular chaining (#19273)
* Revert "Fix ExhaustiveDeps ESLint rule throwing with optional chaining (#19260)"

This reverts commit d242691529.

* 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 GannawayandGitHub 3e20503634 Update useEvent implementation (#19271) 2020-07-07 14:44:56 +01:00
Dominic GannawayandGitHub 894eeff0ea Refactor createEventHandle signature (#19174) 2020-07-07 13:05:06 +01:00
Dominic GannawayandGitHub d91e123a69 Fix event replaying logic (#19269) 2020-07-07 02:28:55 +01:00
RickyandGitHub cb72adf0a0 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 GannawayandGitHub 7574a62a79 Fix master tests (#19267) 2020-07-06 17:36:19 -04:00
Joe LencioniandGitHub d242691529 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 VaughnandGitHub 4b8295e658 Enable createEventHandle API for wWW test builds (#19262) 2020-07-06 15:19:50 -04:00
Dominic GannawayandGitHub 21cd8582f4 Refine event registration + event signatures (#19244)
* Refine event registration + event signatures

* Address feedback
2020-07-06 17:42:01 +01:00
09936459e9 Add SSL support to React devtools standalone (#19191)
Co-authored-by: Brian Vaughn <[email protected]>
2020-07-06 10:09:41 -04:00
Dominic GannawayandGitHub 38fe80ee97 Fix Flow from #19239 (#19242) 2020-07-02 16:37:10 +01:00
Son Ki-KyunandGitHub 26dcd60b54 Add some type detection (#19239) 2020-07-02 15:54:36 +01:00
Dan AbramovandGitHub a95719ea40 Remove event config (#19237) 2020-07-02 00:26:29 +01:00
Dan AbramovandGitHub 1fd17c9927 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 AbramovandGitHub b18cf92b3d Remove TestUtils dependency on event registry (#19235) 2020-07-01 22:54:28 +01:00
Dan AbramovandGitHub 865b3269da 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 GannawayandGitHub 426483668a Add Flow to ModernChangeEventPlugin (#19232) 2020-07-01 21:49:03 +01:00
Dan AbramovandGitHub 73b55e2beb 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 AbramovandGitHub e7bd4e2c09 Enable modern event system and delete dead code (#19230) 2020-07-01 17:43:34 +01:00
Dan AbramovandGitHub 20a1753cee Fork legacy-events folder into react-dom and react-native (#19228) 2020-07-01 16:37:13 +01:00
Dominic GannawayandGitHub 1edf6f1330 Fix responder logic in ReactDOMServerSelectiveHydration-test (#19227) 2020-07-01 16:28:49 +01:00
Dan AbramovandGitHub d8653ee0fc Move responder tests and remove dead code (#19226) 2020-07-01 16:20:49 +01:00
Dan AbramovandGitHub 4ce23e72f5 Run ReactBrowserEventEmitter test on bundles (#19225)
* Run ReactBrowserEventEmitter test on bundles

* Rm bad tests
2020-07-01 16:01:46 +01:00
Dominic GannawayandGitHub 96a726eeb4 Remove React Flare Keyboard responder (#19222) 2020-07-01 15:43:16 +01:00
Dan AbramovandGitHub 186c18f6b7 Fix development mode hang when iframe is removed (#19220)
* Fix development mode hang when iframe is removed

* Also fix #16734
2020-07-01 15:33:29 +01:00
b60da33895 Don't bailout after Suspending in Legacy Mode (#19216)
* Add a failing test for legacy Suspense blocking context updates in memo

* Add more test case coverage for variations of #17356

* Don't bailout after Suspending in Legacy Mode

Co-authored-by: Tharuka Devendra <[email protected]>
2020-06-30 22:06:46 +01:00
Shailendra GuptaandGitHub 374c49167e Added warning to <Context.Provider> in case no value prop is provided (#19054)
* added warning to context.provider in case no value prop

* update message

* updated message and pass undefined
2020-06-30 19:50:55 +01:00
Dan AbramovandGitHub 455f1bd1cc Revert "Add regression test for #18497 (#18538)" (#19215)
This reverts commit 7ef0785791.
2020-06-30 13:38:31 +01:00
Vetrivel ChinnasamyandGitHub f247ad56ad make link https (#19147) 2020-06-30 12:43:52 +01:00
jddxfandGitHub 73824856db Add regression tests where sync render causes later concurrent render to expire soon (#18608)
* Add a failing test for #17911

* Add more test cases where sync render causes later concurrent render to expire soon
2020-06-30 12:42:59 +01:00
Dan Abramov 82594bc30e [email protected] 2020-06-30 12:16:49 +01:00
Fred VollmerandGitHub aae140bdcf fix(eslint-plugin-react-hooks): Support optional chaining when accessing prototype method inside useCallback and useMemo #19061 (#19062)
* fix(eslint-plugin-react-hooks): Support optional chaining when accessing prototype method #19061

* run prettier

* Add fix for #19043
2020-06-30 12:14:00 +01:00