Commit Graph
13448 Commits
Author SHA1 Message Date
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
Andrew ClarkandBrian Vaughn 6ef997b534 Check for passive effects on the root fiber (#19488)
The root fiber doesn't have a parent from which we can read the
`subtreeTag`, so we need to check its `effectTag` directly.

The root fiber previously did not have any pending passive effects,
but it does now that deleted fibers are cleaned up in the passive phase.

This allows us to remove a `schedulePassiveEffectCallback` call from the
synchronous unmount path.

Co-authored-by: Brian Vaughn <bvaughn@fb.com>
2020-07-30 09:17:22 -04:00
Andrew Clark e1f96b82b4 Check PassiveStatic instead of Passive (#19489)
Saves us from having to set a flag on `current` during the layout phase.

Could result in some redundant traversal, since PassiveStatic includes
effects that don't need clean-up. But it's worth it to remove the work
from the layout phase.

While I was editing this, I also re-arranged it so that we check the
`effectTag` check before we check the `tag`, since the `effectTag` check
is the one that's more likely to fail.
2020-07-30 09:13:04 -04:00
Dan Abramov dff97a6915 Fix onGot/LostPointerCapture events (#19487) 2020-07-29 21:54:48 +01:00
Brian VaughnandLuna Ruan eae90cdbe9 Effects list refactor continued: passive effects traversal (#19374)
* Adds new `Passive` subtree tag value.
* Adds recursive traversal for passive effects (mounts and unmounts).
* Removes `pendingPassiveHookEffectsMount` and `pendingPassiveHookEffectsUnmount` arrays from work loop.
* Re-adds sibling and child pointer detaching (temporarily removed in previous PR).
* Addresses some minor TODO comments left over from previous PRs.

---

Co-authored-by: Luna Ruan <luna@fb.com>
2020-07-29 16:54:22 -04:00
Ricky 74cd7e5f17 Use feature flags for React Native in the test renderer (#19486) 2020-07-29 16:31:05 -04:00
Dan Abramov 291db05a75 Add regression tests for all events (#19485) 2020-07-29 21:13:56 +01:00
Ricky 7c8cc4358e Add postTask browser scheduler implementation (#19479)
* Reduce code to necessities

* Switch to postTask API

* Add SchedulerPostTask tests

* Updates from review

* Fix typo from review

* Generate build of unstable_post_task
2020-07-29 15:27:59 -04:00
Dan Abramov 0eea16601c Event propagation test suite (#19483) 2020-07-29 15:34:57 +01:00
Brian Vaughn 5227a37868 Add "unstable_" prefix to experimental mutable source APIs (#19472)
* Add "unstbale_" prefix to mutable source APIs

* DebugHooks no longer calls useMutableSource() on init

This was causing an observable behavioral difference between experimental DEV and PROD builds.

We don't initialize stack position for other composite hooks (e.g. useDeferredValue, useTransition, useOpaqueIdentifier). If we did, it would cause the same obesrvable behavioral difference.
2020-07-28 12:38:13 -04:00
Ricky 52c5146274 Add SchedulerHostConfig fork for post task (#19470) 2020-07-28 11:11:31 -04:00
Andrew Clark 722bc046dc Don't rely on didTimeout for SyncBatched (#19469)
Tasks with SyncBatchedPriority — used by Blocking Mode — should always
be rendered by the `peformSyncWorkOnRoot` path, not
`performConcurrentWorkOnRoot`.

Currently, they go through the `performConcurrentWorkOnRoot` callback.
Then, we check `didTimeout` to see if the task expired. Since
SyncBatchedPriority translates to ImmediatePriority in the Scheduler,
`didTimeout` is always `true`, so we mark it as expired. Then it exits
and re-enters in the `performSyncWorkOnRoot` path.

Aside from being overly convoluted, we shouldn't rely on Scheduler to
tell us that SyncBatchedPriority work is synchronous. We should handle
that ourselves.

This will allow us to remove the `didTimeout` check. And it further
decouples us from the Scheduler priority, so we can eventually remove
that, too.
2020-07-27 14:42:44 -07:00
Sebastian Silbermann feb134c30d feat(react-dom): Add enterKeyHint (#18634) 2020-07-27 21:07:08 +01:00
Andrew Clark 96ac799eac Remove callbackId field from FiberRoot (#19458)
The old expiration times implementation used this field to infer when
the priority of a task had changed at a more granular level than a
Scheduler priority level.

Now that we have the LanePriority type, which is React-specific, we no
longer need the `callbackId` field.
2020-07-27 10:39:07 -07:00
Andrew Clark c24b641b76 Remove timeout option from scheduleCallback (#19457)
Since the Lanes refactor landed, we no longer rely on this anywhere, so
we can remove it.

The `delay` option is still needed by our timer implementation
(setTimeout polyfill). We'll keep the feature, but we'll likely change
how it's exposed once we figure out the proper layering between the
various Scheduler APIs.
2020-07-27 09:56:25 -07: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
Ricky d29bf59a6e Update my mailmap entries (#19455) 2020-07-26 22:47:32 -04:00
Ashwin Ramaswami 5530f1ccfb Upgrade art fixtures to babel 7 (#16235)
* chore: upgrade art fixtures to babel 7

* upgrade

* use yarn
2020-07-25 23:43:49 -04: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
Robert Ferentz b55f75d0a5 fix issue #19362 + test (#19412) 2020-07-24 14:34:16 -04:00
Sebastian Markbåge d93c8faada Move Persistent Mode Optimization away from firstEffect (#19381)
Persistent mode needs to clone a parent and add its children if a child has
changed.

We have an optimization in persistent mode where we don't do that if no
child could've changed. If there are no effects scheduled for any child
then there couldn't have been changes.

Instead of checking for this on firstEffect, we now check this on the
children's effectTag and subtreeTags.

This is quite unfortunate because if we could just do this check a little
bit later we would've already gotten it transferred to the completed work's
subtreeTag. Now we have to loop over all the children and if any of them
changed, we have to loop over them again. Doing at least two loops per
parent.
2020-07-24 09:31:30 -07:00
Ricky 909b612e27 Sync React Native types (#19437) 2020-07-22 22:56:05 -04: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 GannawayandDan Abramov 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 c9749d38e3 Generate RN renderers for stable builds (#19421)
* Generate RN renderers for experimental builds

* Don't generate FB builds for experimental channels
2020-07-20 17:15:06 -04:00
Sebastian Markbåge ab1f517000 isFBBundle should be true if it's FB for www or FB for RN (#19420)
This ensures that the .fb.js override files kick in for RN. Otherwise we
won't have FB specific exports in the isomorphic modules.
2020-07-20 10:37:04 -07:00
Haseeb Khan ecbdb74d7c Added the word "events" to clear ambiguousness. (#19409) 2020-07-20 18:26:41 +01:00
Andrew Clark b23ea02be5 Track event times per lane on the root (#19387)
* Pass event time to markRootUpdated

Some minor rearranging so that eventTime gets threaded through. No
change in behavior.

* Track event times per lane on the root

Previous strategy was to store the event time on the update object
and accumulate the most recent one during the render phase.

Among other advantages, by tracking them on the root, we can read the
event time before the render phase has finished.

I haven't removed the `eventTime` field from the update object yet,
because it's still used to compute the timeout. Tracking the timeout
on the root is my next step.
2020-07-17 10:47:39 -07: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
Dominic Gannaway 4c8c98ab9b Sync latest useFocus/useFocusWithin changes (#19397) 2020-07-17 16:26:40 +01:00
Brian Vaughn 51267c4ac9 Sync scheduling profiler marks and debug tracing to new reconciler fork (#19375, #19376, #19396)
* Make enableSchedulingProfiler flag static

* Copied debug tracing and scheduler profiling to .new fork and updated feature flags

* Move profiler component stacks behind a feature flag
2020-07-17 11:24:26 -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
Ricky bc4cd92cd5 Use jest-environment-jsdom-sixteen (#19288)
* Use jest-environment-jsdom-sixteen

* Update yarn.lock

* Dedupe new jest packages in yarn.lock

* Pull upstream changes
2020-07-16 10:17:31 -04:00
Dominic Gannaway e387c98ffa Fix bug with enableLegacyFBSupport click handlers (#19378) 2020-07-16 14:56:31 +01:00
Brian VaughnandLuna 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 fed4ae0247 DevTools 4.8.1 -> 4.8.2 (and CHANGELOG) 2020-07-15 12:37:08 -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
Dan Abramov 4961833dbf Don't build shallow renderer UMD bundles 2020-07-15 16:53:02 +01:00
Brian Vaughn a9ba5283d9 Disable DevTools minification (#19369)
DevTools isn't being downloaded like typical JavaScript, so bundle size concerns don't apply. Parsing is still a consideration (so I'm open for discussion here) but I think this change would provide a couple of benefits:
* People are more likely to *actually read* non-minified source code when e.g. a breakpoint is hit (as with the recent debugger statement)
* Component stacks will be easier to parse on bug reports
2020-07-15 10:38:30 -04:00