Skip to content

Commit

Permalink
Rename UserBlockingEvent to ContinuousEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Feb 5, 2021
1 parent c470ad8 commit 1258478
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 31 deletions.
6 changes: 3 additions & 3 deletions packages/react-dom/src/client/ReactDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
flushPassiveEffects,
IsThisRendererActing,
attemptSynchronousHydration,
attemptUserBlockingHydration,
attemptDiscreteHydration,
attemptContinuousHydration,
attemptHydrationAtCurrentPriority,
runWithPriority,
Expand All @@ -56,7 +56,7 @@ import {
import {restoreControlledState} from './ReactDOMComponent';
import {
setAttemptSynchronousHydration,
setAttemptUserBlockingHydration,
setAttemptDiscreteHydration,
setAttemptContinuousHydration,
setAttemptHydrationAtCurrentPriority,
queueExplicitHydrationTarget,
Expand All @@ -71,7 +71,7 @@ import {
} from '../events/ReactDOMControlledComponent';

setAttemptSynchronousHydration(attemptSynchronousHydration);
setAttemptUserBlockingHydration(attemptUserBlockingHydration);
setAttemptDiscreteHydration(attemptDiscreteHydration);
setAttemptContinuousHydration(attemptContinuousHydration);
setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority);
setGetCurrentUpdatePriority(getCurrentUpdateLanePriority);
Expand Down
12 changes: 4 additions & 8 deletions packages/react-dom/src/events/DOMEventProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ import {
ANIMATION_START,
TRANSITION_END,
} from './DOMEventNames';
import {
DiscreteEvent,
UserBlockingEvent,
DefaultEvent,
} from 'shared/ReactTypes';
import {DiscreteEvent, ContinuousEvent, DefaultEvent} from 'shared/ReactTypes';

import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags';

Expand Down Expand Up @@ -97,7 +93,7 @@ if (enableCreateEventHandleAPI) {
}

// prettier-ignore
const userBlockingPairsForSimpleEventPlugin: Array<string | DOMEventName> = [
const continuousPairsForSimpleEventPlugin: Array<string | DOMEventName> = [
('drag': DOMEventName), 'drag',
('dragenter': DOMEventName), 'dragEnter',
('dragexit': DOMEventName), 'dragExit',
Expand Down Expand Up @@ -219,8 +215,8 @@ export function registerSimpleEvents() {
DiscreteEvent,
);
registerSimplePluginEventsAndSetTheirPriorities(
userBlockingPairsForSimpleEventPlugin,
UserBlockingEvent,
continuousPairsForSimpleEventPlugin,
ContinuousEvent,
);
registerSimplePluginEventsAndSetTheirPriorities(
defaultPairsForSimpleEventPlugin,
Expand Down
12 changes: 4 additions & 8 deletions packages/react-dom/src/events/ReactDOMEventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ import {
decoupleUpdatePriorityFromScheduler,
enableNewReconciler,
} from 'shared/ReactFeatureFlags';
import {
UserBlockingEvent,
DefaultEvent,
DiscreteEvent,
} from 'shared/ReactTypes';
import {ContinuousEvent, DefaultEvent, DiscreteEvent} from 'shared/ReactTypes';
import {getEventPriorityForPluginSystem} from './DOMEventProperties';
import {dispatchEventForPluginEventSystem} from './DOMPluginEventSystem';
import {
Expand Down Expand Up @@ -118,8 +114,8 @@ export function createEventListenerWrapperWithPriority(
case DiscreteEvent:
listenerWrapper = dispatchDiscreteEvent;
break;
case UserBlockingEvent:
listenerWrapper = dispatchUserBlockingUpdate;
case ContinuousEvent:
listenerWrapper = dispatchContinuousEvent;
break;
case DefaultEvent:
default:
Expand Down Expand Up @@ -157,7 +153,7 @@ function dispatchDiscreteEvent(
);
}

function dispatchUserBlockingUpdate(
function dispatchContinuousEvent(
domEventName,
eventSystemFlags,
container,
Expand Down
8 changes: 4 additions & 4 deletions packages/react-dom/src/events/ReactDOMEventReplaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export function setAttemptSynchronousHydration(fn: (fiber: Object) => void) {
attemptSynchronousHydration = fn;
}

let attemptUserBlockingHydration: (fiber: Object) => void;
let attemptDiscreteHydration: (fiber: Object) => void;

export function setAttemptUserBlockingHydration(fn: (fiber: Object) => void) {
attemptUserBlockingHydration = fn;
export function setAttemptDiscreteHydration(fn: (fiber: Object) => void) {
attemptDiscreteHydration = fn;
}

let attemptContinuousHydration: (fiber: Object) => void;
Expand Down Expand Up @@ -489,7 +489,7 @@ function replayUnblockedEvents() {
// the next discrete event.
const fiber = getInstanceFromNode(nextDiscreteEvent.blockedOn);
if (fiber !== null) {
attemptUserBlockingHydration(fiber);
attemptDiscreteHydration(fiber);
}
break;
}
Expand Down
10 changes: 5 additions & 5 deletions packages/react-reconciler/src/ReactFiberReconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
IsThisRendererActing as IsThisRendererActing_old,
getPublicRootInstance as getPublicRootInstance_old,
attemptSynchronousHydration as attemptSynchronousHydration_old,
attemptUserBlockingHydration as attemptUserBlockingHydration_old,
attemptDiscreteHydration as attemptDiscreteHydration_old,
attemptContinuousHydration as attemptContinuousHydration_old,
attemptHydrationAtCurrentPriority as attemptHydrationAtCurrentPriority_old,
findHostInstance as findHostInstance_old,
Expand Down Expand Up @@ -69,7 +69,7 @@ import {
IsThisRendererActing as IsThisRendererActing_new,
getPublicRootInstance as getPublicRootInstance_new,
attemptSynchronousHydration as attemptSynchronousHydration_new,
attemptUserBlockingHydration as attemptUserBlockingHydration_new,
attemptDiscreteHydration as attemptDiscreteHydration_new,
attemptContinuousHydration as attemptContinuousHydration_new,
attemptHydrationAtCurrentPriority as attemptHydrationAtCurrentPriority_new,
findHostInstance as findHostInstance_new,
Expand Down Expand Up @@ -134,9 +134,9 @@ export const getPublicRootInstance = enableNewReconciler
export const attemptSynchronousHydration = enableNewReconciler
? attemptSynchronousHydration_new
: attemptSynchronousHydration_old;
export const attemptUserBlockingHydration = enableNewReconciler
? attemptUserBlockingHydration_new
: attemptUserBlockingHydration_old;
export const attemptDiscreteHydration = enableNewReconciler
? attemptDiscreteHydration_new
: attemptDiscreteHydration_old;
export const attemptContinuousHydration = enableNewReconciler
? attemptContinuousHydration_new
: attemptContinuousHydration_old;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberReconciler.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ function markRetryLaneIfNotHydrated(fiber: Fiber, retryLane: Lane) {
}
}

export function attemptUserBlockingHydration(fiber: Fiber): void {
export function attemptDiscreteHydration(fiber: Fiber): void {
if (fiber.tag !== SuspenseComponent) {
// We ignore HostRoots here because we can't increase
// their priority and they should not suspend on I/O,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberReconciler.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ function markRetryLaneIfNotHydrated(fiber: Fiber, retryLane: Lane) {
}
}

export function attemptUserBlockingHydration(fiber: Fiber): void {
export function attemptDiscreteHydration(fiber: Fiber): void {
if (fiber.tag !== SuspenseComponent) {
// We ignore HostRoots here because we can't increase
// their priority and they should not suspend on I/O,
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/ReactTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export type RefObject = {|
export type EventPriority = 0 | 1 | 2;

export const DiscreteEvent: EventPriority = 0;
export const UserBlockingEvent: EventPriority = 1;
export const ContinuousEvent: EventPriority = 1;
export const DefaultEvent: EventPriority = 2;

export type ReactFundamentalComponentInstance<C, H> = {|
Expand Down

0 comments on commit 1258478

Please sign in to comment.