Commit Graph

1110 Commits

Author SHA1 Message Date
Brian Vaughn bcca5a6ca7 Always skip unmounted/unmounting error boundaries (#19627)
The behavior of error boundaries for passive effects that throw during cleanup was recently changed so that React ignores boundaries which are also unmounting in favor of still-mounted boundaries. This commit implements that same behavior for layout effects (useLayoutEffect, componentWillUnmount, and ref-detachment).

The new, skip-unmounting-boundaries behavior is behind a feature flag (`skipUnmountedBoundaries`).
2020-08-17 15:01:06 -04:00
Jack Works 1287670191 Fix: React cannot render in ShadowRoot (#15894)
* fix: render in shadow root

* fix: flow typing

* Remove types and turn invariant into warning

Co-authored-by: Dan Abramov <dan.abramov@me.com>
2020-08-17 15:47:49 +01:00
CY Lim 702fad4b1b refactor fb.me redirect link to reactjs.org/link (#19598)
* refactor fb.me url to reactjs.org/link

* Update ESLintRuleExhaustiveDeps-test.js

* Update ReactDOMServerIntegrationUntrustedURL-test.internal.js

* Update createReactClassIntegration-test.js

* Update ReactDOMServerIntegrationUntrustedURL-test.internal.js

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
2020-08-17 13:25:50 +01:00
Brian Vaughn ffb749c95e Improve error boundary handling for unmounted subtrees (#19542)
A passive effect's cleanup function may throw after an unmount. Prior to this commit, such an error would be ignored. (React would not notify any error boundaries.) After this commit, React's behavior varies depending on which reconciler fork is being used.

For the old reconciler, React will call componentDidCatch for the nearest unmounted error boundary (if there is one). If there are no unmounted error boundaries, React will still swallow the error because the return pointer has been disconnected, so the normal error handling logic does not know how to traverse the tree to find the nearest still-mounted ancestor.

For the new reconciler, React will skip any unmounted boundaries and look for a still-mounted boundary. If one is found, it will call getDerivedStateFromError and/or componentDidCatch (depending on the type of boundary).

Tests have been added for both reconciler variants for now.
2020-08-14 16:46:46 -04:00
Clay Tercek fe6d05229f fix event.relatedTarget fallback logic for firefox (#19607)
* fix event.relatedTarget fallback logic for firefox

* check if relatedTarget is undefined for fallback
2020-08-14 13:05:53 +01:00
Dan Abramov 94c0244bab Fix double-firing mouseenter (#19571)
* test: Simulate mouseover in browser

* Fix duplicate onMouseEnter event when relatedTarget is a root

* Test leave as well

Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
2020-08-10 15:08:22 +01:00
Dan Abramov aa99b0b08e Rename test files 2020-08-10 12:58:42 +01:00
Sebastian Silbermann 7f696bd99c fix: onFocus/onBlur/onBeforeInput have a matching event type (#19561)
* test: Add current behavior for event types of onFocus/onBlur

* fix: onFocus/onBlur have a matching event type

* fix useFocus

* fix: don't compare native event types with react event types

* Add FocusIn/FocusOutEventInterface

* A simpler alternative fix

* Add regression tests

* Always pass React event type and fix beforeinput

Co-authored-by: Dan Abramov <dan.abramov@me.com>
2020-08-10 12:54:10 +01:00
Brian Vaughn a63893ff32 Warn about undefined return value for memo and forwardRef (#19550) 2020-08-06 16:12:32 -04:00
Ricky 32ff428687 Add feature flag for setting update lane priority (#19401)
* Add feature flag for setting update lane priority

* Remove second feature flag

* Refactor feature flag locations

* Add missing else
2020-08-06 12:47:32 -04:00
DaniAcu 50893dbcb7 fix(react-dom): unnecesary path on DOMEventProperties (#19544) 2020-08-06 16:37:06 +01:00
Dominic Gannaway f77c7b9d76 Re-add discrete flushing timeStamp heuristic (behind flag) (#19540) 2020-08-06 13:21:05 +01:00
Dan Abramov e9721e14e4 Remove onScroll bubbling flag (#19535) 2020-08-05 16:07:58 +01:00
Dominic Gannaway b61174fb7b Remove the deprecated React Flare event system (#19520) 2020-08-05 15:13:29 +01:00
Dan Abramov 332eceface Revert "Statically enable enableFilterEmptyStringAttributesDOM (#19502)" (#19504)
This reverts commit 815ee89bf5.
2020-07-31 15:01:27 +01:00
Dan Abramov 815ee89bf5 Statically enable enableFilterEmptyStringAttributesDOM (#19502) 2020-07-31 14:57:57 +01:00
Dan Abramov 22d16cc15d Remove event constants (#19276)
* Remove opaque event type

* Rename type and merge files

* Use literals where we have Flow coverage

* Flowify some plugins

* Remove constants except necessary ones
2020-07-30 21:52:37 +01:00
Dan Abramov dff97a6915 Fix onGot/LostPointerCapture events (#19487) 2020-07-29 21:54:48 +01:00
Dan Abramov 291db05a75 Add regression tests for all events (#19485) 2020-07-29 21:13:56 +01:00
Dan Abramov 0eea16601c Event propagation test suite (#19483) 2020-07-29 15:34:57 +01:00
Sebastian Silbermann feb134c30d feat(react-dom): Add enterKeyHint (#18634) 2020-07-27 21:07:08 +01:00
Dominic Gannaway 144297165b Bail-out of attaching non-delegated listeners (#19466)
* Bail-out of attaching non-delegated listeners

Revise comment

* Fix tests/add tests

* Add onInvalid test
2020-07-27 17:47:14 +01:00
Dan Abramov 06d104e8ec Don't emulate bubbling of the scroll event (#19464)
* Don't emulate bubbling of the scroll event

* Put behind a flag
2020-07-27 17:33:54 +01:00
Dominic Gannaway 217ecf581b Re-added toggle event to non-delegated events (#19465) 2020-07-27 16:58:38 +01:00
Dominic Gannaway 6bb86fd162 Delegated all capture events (#19463) 2020-07-27 15:36:43 +01:00
Dominic Gannaway 05344faca4 Follow up fix to 19452 (#19454) 2020-07-27 15:03:11 +01:00
Dominic Gannaway 242a50a652 Fix issue with capture phase non-bubbling events (#19452) 2020-07-25 12:32:21 +01:00
Dominic Gannaway ef22aecfc5 Add invalid/close events to <dialog> element (#19439)
Support dialog

Fix
2020-07-24 20:36:46 +01:00
Dan Abramov 76ce685d0f Remove SyntheticEvent subtypes (#19436)
* Remove SyntheticEvent subtypes

* Code golf
2020-07-23 01:02:59 +01:00
Dominic Gannaway 30e3cfe406 Fix scope issue (#19434) 2020-07-22 23:05:50 +01:00
Dan Abramov 125d1a19a2 Move event things around (#19433)
* Put all synthetic events in one file

* Inline other helpers

* Remove Modern from filenames
2020-07-22 22:12:15 +01:00
Dominic Gannaway 1aae05c436 Revise comment + add non-bubbling event test (#19432) 2020-07-22 21:41:40 +01:00
Dominic Gannaway 356c17108f Remove capturePhaseEvents and separate events by bubbling (#19278)
* Remove capturePhaseEvents and separate events by bubbling

WIP

Refine all logic

Revise types

Fix

Fix conflicts

Fix flags

Fix

Fix

Fix test

Revise

Cleanup

Refine

Deal with replaying

Fix

* Add non delegated listeners unconditionally

* Add media events

* Fix a previously ignored test

* Address feedback

Co-authored-by: Dan Abramov <dan.abramov@me.com>
2020-07-21 22:40:50 +01:00
Dan Abramov 1dcee86565 Regression test for media event bubbling (#19428) 2020-07-21 22:26:09 +01:00
Ricky faa697f4f9 Set current update lane priority for user blocking events (#19342)
* Set current update lane priority for user blocking events

* Update to use LanePriority and not use runWithPriority

* Remove unused imports

* Fix tests, and I missed ReactDOMEventListener

* Fix more tests

* Add try/finally and hardcode lane priorities instead

* Also hard code InputContinuousLanePriority in tests

* Remove un-needed exports

* Comment rollbacks
2020-07-17 12:58:44 -04:00
Dan Abramov aec934af7f Remove form event delegation flag (#19395) 2020-07-17 14:19:39 +01:00
Dominic Gannaway a59f899a1d Modern Event System: use focusin/focusout for onFocus/onBlur (#19186) 2020-07-16 18:12:03 +01:00
Dominic Gannaway 9102719baa Tidy up React Scope API (#19352) 2020-07-16 16:21:21 +01:00
Dominic Gannaway e387c98ffa Fix bug with enableLegacyFBSupport click handlers (#19378) 2020-07-16 14:56:31 +01:00
Brian Vaughn a226b9b445 Effects list refactor continued: did-bailout flag (#19322)
* Effects list rewrite

* Improved deletions approach

Process deletions as we traverse the tree during commit, before we process other effects. This has the result of better mimicking the previous sequencing.

* Made deletions field nullable

* Revert (no longer necessary) change to ReactNative test

* Eagerly set Deletions effect on Fiber when adding child to deletions array

* Initialize deletions array to null

* Null out deletions array instead of splicing 🤡

* Removed TODO comment

* Initial exploration on a did-bailout flag

* fixed the rest of the bugs

* Rolled temporary didBailout attribute into subtreeTag

* addressed comments

* Removed DidBailout subtree tag

* Removed stale comment

* use while loop instead of recursion for siblings

* move bailout flag from while loop

* Removed some unnecessary Deletion effectTags from children

* Move Deletion effect assignment to deletions array initialization

Co-authored-by: Luna <lunaris.ruan@gmail.com>
2020-07-16 09:10:00 -04:00
Brian Vaughn a89854bc93 Fix Suspense-wrapping heuristic (and bump version numbers) (#19373)
* Fixed suspense wrapping heuristic

* Bump package numbers 16.13.1 -> 17.0.0-alpha.0 to fix DevTools Suspense heuristic
2020-07-15 12:25:27 -04:00
Dominic Gannaway c604b69973 Revert "Revert "Fix createEventHandle bug with comment containers (#19348)" (#19354)" (#19365)
This reverts commit 566f613763.
2020-07-15 12:35:46 +01:00
Dominic Gannaway 566f613763 Revert "Fix createEventHandle bug with comment containers (#19348)" (#19354)
This reverts commit 147179ae82.
2020-07-15 12:27:22 +01:00
Dominic Gannaway 147179ae82 Fix createEventHandle bug with comment containers (#19348) 2020-07-14 13:09:39 +01:00
Dan Abramov 26472c8897 Bubble onSubmit/onReset behind a feature flag (#19333) 2020-07-13 17:17:28 +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 e0e6b9c036 Add regression test for #19269 (#19282) 2020-07-08 20:48:43 +01:00
Dominic Gannaway f5ea39c182 Modern Event System: make on*Capture events use capture phase (#19221) 2020-07-08 17:10:06 +01: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
Dominic Gannaway 4eb9b1d2b4 Refactor createEventHandle signature (#19174) 2020-07-07 13:05:06 +01:00