GeezerVison is showing github.com — Align event group constant naming with lane naming (#20744) · react/react@b5bac18
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/client/ReactDOM.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,7 +32,7 @@ import { | 32 | 32 | flushPassiveEffects, | 33 | 33 | IsThisRendererActing, | 34 | 34 | attemptSynchronousHydration, | 35 | | - attemptUserBlockingHydration, | | 35 | + attemptDiscreteHydration, | 36 | 36 | attemptContinuousHydration, | 37 | 37 | attemptHydrationAtCurrentPriority, | 38 | 38 | runWithPriority, | @@ -56,7 +56,7 @@ import { | 56 | 56 | import {restoreControlledState} from './ReactDOMComponent'; | 57 | 57 | import { | 58 | 58 | setAttemptSynchronousHydration, | 59 | | - setAttemptUserBlockingHydration, | | 59 | + setAttemptDiscreteHydration, | 60 | 60 | setAttemptContinuousHydration, | 61 | 61 | setAttemptHydrationAtCurrentPriority, | 62 | 62 | queueExplicitHydrationTarget, | @@ -71,7 +71,7 @@ import { | 71 | 71 | } from '../events/ReactDOMControlledComponent'; | 72 | 72 |
| 73 | 73 | setAttemptSynchronousHydration(attemptSynchronousHydration); | 74 | | -setAttemptUserBlockingHydration(attemptUserBlockingHydration); | | 74 | +setAttemptDiscreteHydration(attemptDiscreteHydration); | 75 | 75 | setAttemptContinuousHydration(attemptContinuousHydration); | 76 | 76 | setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority); | 77 | 77 | setGetCurrentUpdatePriority(getCurrentUpdateLanePriority); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/events/DOMEventProperties.js +10-14Lines changed: 10 additions & 14 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -17,11 +17,7 @@ import { | 17 | 17 | ANIMATION_START, | 18 | 18 | TRANSITION_END, | 19 | 19 | } from './DOMEventNames'; | 20 | | -import { | 21 | | - DiscreteEvent, | 22 | | - UserBlockingEvent, | 23 | | - ContinuousEvent, | 24 | | -} from 'shared/ReactTypes'; | | 20 | +import {DiscreteEvent, ContinuousEvent, DefaultEvent} from 'shared/ReactTypes'; | 25 | 21 |
| 26 | 22 | import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags'; | 27 | 23 |
| @@ -97,7 +93,7 @@ if (enableCreateEventHandleAPI) { | 97 | 93 | } | 98 | 94 |
| 99 | 95 | // prettier-ignore | 100 | | -const userBlockingPairsForSimpleEventPlugin: Array<string | DOMEventName> = [ | | 96 | +const continuousPairsForSimpleEventPlugin: Array<string | DOMEventName> = [ | 101 | 97 | ('drag': DOMEventName), 'drag', | 102 | 98 | ('dragenter': DOMEventName), 'dragEnter', | 103 | 99 | ('dragexit': DOMEventName), 'dragExit', | @@ -116,7 +112,7 @@ const userBlockingPairsForSimpleEventPlugin: Array<string | DOMEventName> = [ | 116 | 112 | ]; | 117 | 113 |
| 118 | 114 | // prettier-ignore | 119 | | -const continuousPairsForSimpleEventPlugin: Array<string | DOMEventName> = [ | | 115 | +const defaultPairsForSimpleEventPlugin: Array<string | DOMEventName> = [ | 120 | 116 | ('abort': DOMEventName), 'abort', | 121 | 117 | (ANIMATION_END: DOMEventName), 'animationEnd', | 122 | 118 | (ANIMATION_ITERATION: DOMEventName), 'animationIteration', | @@ -190,10 +186,10 @@ export function getEventPriorityForPluginSystem( | 190 | 186 | domEventName: DOMEventName, | 191 | 187 | ): EventPriority { | 192 | 188 | const priority = eventPriorities.get(domEventName); | 193 | | - // Default to a ContinuousEvent. Note: we might | | 189 | + // Default to a DefaultEvent. Note: we might | 194 | 190 | // want to warn if we can't detect the priority | 195 | 191 | // for the event. | 196 | | - return priority === undefined ? ContinuousEvent : priority; | | 192 | + return priority === undefined ? DefaultEvent : priority; | 197 | 193 | } | 198 | 194 |
| 199 | 195 | export function getEventPriorityForListenerSystem( | @@ -210,21 +206,21 @@ export function getEventPriorityForListenerSystem( | 210 | 206 | type, | 211 | 207 | ); | 212 | 208 | } | 213 | | - return ContinuousEvent; | | 209 | + return DefaultEvent; | 214 | 210 | } | 215 | 211 |
| 216 | 212 | export function registerSimpleEvents() { | 217 | 213 | registerSimplePluginEventsAndSetTheirPriorities( | 218 | 214 | discreteEventPairsForSimpleEventPlugin, | 219 | 215 | DiscreteEvent, | 220 | 216 | ); | 221 | | - registerSimplePluginEventsAndSetTheirPriorities( | 222 | | - userBlockingPairsForSimpleEventPlugin, | 223 | | - UserBlockingEvent, | 224 | | - ); | 225 | 217 | registerSimplePluginEventsAndSetTheirPriorities( | 226 | 218 | continuousPairsForSimpleEventPlugin, | 227 | 219 | ContinuousEvent, | 228 | 220 | ); | | 221 | + registerSimplePluginEventsAndSetTheirPriorities( | | 222 | + defaultPairsForSimpleEventPlugin, | | 223 | + DefaultEvent, | | 224 | + ); | 229 | 225 | setEventPriorities(otherDiscreteEvents, DiscreteEvent); | 230 | 226 | } |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/events/ReactDOMEventListener.js +5-9Lines changed: 5 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,11 +43,7 @@ import { | 43 | 43 | decoupleUpdatePriorityFromScheduler, | 44 | 44 | enableNewReconciler, | 45 | 45 | } from 'shared/ReactFeatureFlags'; | 46 | | -import { | 47 | | - UserBlockingEvent, | 48 | | - ContinuousEvent, | 49 | | - DiscreteEvent, | 50 | | -} from 'shared/ReactTypes'; | | 46 | +import {ContinuousEvent, DefaultEvent, DiscreteEvent} from 'shared/ReactTypes'; | 51 | 47 | import {getEventPriorityForPluginSystem} from './DOMEventProperties'; | 52 | 48 | import {dispatchEventForPluginEventSystem} from './DOMPluginEventSystem'; | 53 | 49 | import { | @@ -118,10 +114,10 @@ export function createEventListenerWrapperWithPriority( | 118 | 114 | case DiscreteEvent: | 119 | 115 | listenerWrapper = dispatchDiscreteEvent; | 120 | 116 | break; | 121 | | - case UserBlockingEvent: | 122 | | - listenerWrapper = dispatchUserBlockingUpdate; | 123 | | - break; | 124 | 117 | case ContinuousEvent: | | 118 | + listenerWrapper = dispatchContinuousEvent; | | 119 | + break; | | 120 | + case DefaultEvent: | 125 | 121 | default: | 126 | 122 | listenerWrapper = dispatchEvent; | 127 | 123 | break; | @@ -157,7 +153,7 @@ function dispatchDiscreteEvent( | 157 | 153 | ); | 158 | 154 | } | 159 | 155 |
| 160 | | -function dispatchUserBlockingUpdate( | | 156 | +function dispatchContinuousEvent( | 161 | 157 | domEventName, | 162 | 158 | eventSystemFlags, | 163 | 159 | container, | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/events/ReactDOMEventReplaying.js +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -39,10 +39,10 @@ export function setAttemptSynchronousHydration(fn: (fiber: Object) => void) { | 39 | 39 | attemptSynchronousHydration = fn; | 40 | 40 | } | 41 | 41 |
| 42 | | -let attemptUserBlockingHydration: (fiber: Object) => void; | | 42 | +let attemptDiscreteHydration: (fiber: Object) => void; | 43 | 43 |
| 44 | | -export function setAttemptUserBlockingHydration(fn: (fiber: Object) => void) { | 45 | | - attemptUserBlockingHydration = fn; | | 44 | +export function setAttemptDiscreteHydration(fn: (fiber: Object) => void) { | | 45 | + attemptDiscreteHydration = fn; | 46 | 46 | } | 47 | 47 |
| 48 | 48 | let attemptContinuousHydration: (fiber: Object) => void; | @@ -489,7 +489,7 @@ function replayUnblockedEvents() { | 489 | 489 | // the next discrete event. | 490 | 490 | const fiber = getInstanceFromNode(nextDiscreteEvent.blockedOn); | 491 | 491 | if (fiber !== null) { | 492 | | - attemptUserBlockingHydration(fiber); | | 492 | + attemptDiscreteHydration(fiber); | 493 | 493 | } | 494 | 494 | break; | 495 | 495 | } | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberReconciler.js +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,7 +29,7 @@ import { | 29 | 29 | IsThisRendererActing as IsThisRendererActing_old, | 30 | 30 | getPublicRootInstance as getPublicRootInstance_old, | 31 | 31 | attemptSynchronousHydration as attemptSynchronousHydration_old, | 32 | | - attemptUserBlockingHydration as attemptUserBlockingHydration_old, | | 32 | + attemptDiscreteHydration as attemptDiscreteHydration_old, | 33 | 33 | attemptContinuousHydration as attemptContinuousHydration_old, | 34 | 34 | attemptHydrationAtCurrentPriority as attemptHydrationAtCurrentPriority_old, | 35 | 35 | findHostInstance as findHostInstance_old, | @@ -69,7 +69,7 @@ import { | 69 | 69 | IsThisRendererActing as IsThisRendererActing_new, | 70 | 70 | getPublicRootInstance as getPublicRootInstance_new, | 71 | 71 | attemptSynchronousHydration as attemptSynchronousHydration_new, | 72 | | - attemptUserBlockingHydration as attemptUserBlockingHydration_new, | | 72 | + attemptDiscreteHydration as attemptDiscreteHydration_new, | 73 | 73 | attemptContinuousHydration as attemptContinuousHydration_new, | 74 | 74 | attemptHydrationAtCurrentPriority as attemptHydrationAtCurrentPriority_new, | 75 | 75 | findHostInstance as findHostInstance_new, | @@ -134,9 +134,9 @@ export const getPublicRootInstance = enableNewReconciler | 134 | 134 | export const attemptSynchronousHydration = enableNewReconciler | 135 | 135 | ? attemptSynchronousHydration_new | 136 | 136 | : attemptSynchronousHydration_old; | 137 | | -export const attemptUserBlockingHydration = enableNewReconciler | 138 | | - ? attemptUserBlockingHydration_new | 139 | | - : attemptUserBlockingHydration_old; | | 137 | +export const attemptDiscreteHydration = enableNewReconciler | | 138 | + ? attemptDiscreteHydration_new | | 139 | + : attemptDiscreteHydration_old; | 140 | 140 | export const attemptContinuousHydration = enableNewReconciler | 141 | 141 | ? attemptContinuousHydration_new | 142 | 142 | : attemptContinuousHydration_old; | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberReconciler.new.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -396,7 +396,7 @@ function markRetryLaneIfNotHydrated(fiber: Fiber, retryLane: Lane) { | 396 | 396 | } | 397 | 397 | } | 398 | 398 |
| 399 | | -export function attemptUserBlockingHydration(fiber: Fiber): void { | | 399 | +export function attemptDiscreteHydration(fiber: Fiber): void { | 400 | 400 | if (fiber.tag !== SuspenseComponent) { | 401 | 401 | // We ignore HostRoots here because we can't increase | 402 | 402 | // their priority and they should not suspend on I/O, | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberReconciler.old.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -396,7 +396,7 @@ function markRetryLaneIfNotHydrated(fiber: Fiber, retryLane: Lane) { | 396 | 396 | } | 397 | 397 | } | 398 | 398 |
| 399 | | -export function attemptUserBlockingHydration(fiber: Fiber): void { | | 399 | +export function attemptDiscreteHydration(fiber: Fiber): void { | 400 | 400 | if (fiber.tag !== SuspenseComponent) { | 401 | 401 | // We ignore HostRoots here because we can't increase | 402 | 402 | // their priority and they should not suspend on I/O, | |
Collapse file Copy file name to clipboardExpand all lines: packages/shared/ReactTypes.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -89,8 +89,8 @@ export type RefObject = {| | 89 | 89 | export type EventPriority = 0 | 1 | 2; | 90 | 90 |
| 91 | 91 | export const DiscreteEvent: EventPriority = 0; | 92 | | -export const UserBlockingEvent: EventPriority = 1; | 93 | | -export const ContinuousEvent: EventPriority = 2; | | 92 | +export const ContinuousEvent: EventPriority = 1; | | 93 | +export const DefaultEvent: EventPriority = 2; | 94 | 94 |
| 95 | 95 | export type ReactScope = {| | 96 | 96 | $$typeof: Symbol | number, | |
|