Skip to content

Commit 96136ab

Browse files
author
Jack Pope
committed
f
1 parent d278b8f commit 96136ab

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

packages/react-reconciler/src/ReactFiberHooks.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,12 +1060,12 @@ function updateWorkInProgressHook(): Hook {
10601060

10611061
function unstable_useContextWithBailout<T>(
10621062
context: ReactContext<T>,
1063-
compare: (T => Array<mixed>) | null,
1063+
select: (T => Array<mixed>) | null,
10641064
): T {
1065-
if (compare === null) {
1065+
if (select === null) {
10661066
return readContext(context);
10671067
}
1068-
return readContextAndCompare(context, compare);
1068+
return readContextAndCompare(context, select);
10691069
}
10701070

10711071
// NOTE: defining two versions of this function to avoid size impact when this feature is disabled.
@@ -4054,11 +4054,11 @@ if (__DEV__) {
40544054
(HooksDispatcherOnMountInDEV: Dispatcher).unstable_useContextWithBailout =
40554055
function <T>(
40564056
context: ReactContext<T>,
4057-
compare: (T => Array<mixed>) | null,
4057+
select: (T => Array<mixed>) | null,
40584058
): T {
40594059
currentHookNameInDev = 'useContext';
40604060
mountHookTypesDev();
4061-
return unstable_useContextWithBailout(context, compare);
4061+
return unstable_useContextWithBailout(context, select);
40624062
};
40634063
}
40644064

@@ -4246,11 +4246,11 @@ if (__DEV__) {
42464246
(HooksDispatcherOnMountWithHookTypesInDEV: Dispatcher).unstable_useContextWithBailout =
42474247
function <T>(
42484248
context: ReactContext<T>,
4249-
compare: (T => Array<mixed>) | null,
4249+
select: (T => Array<mixed>) | null,
42504250
): T {
42514251
currentHookNameInDev = 'useContext';
42524252
updateHookTypesDev();
4253-
return unstable_useContextWithBailout(context, compare);
4253+
return unstable_useContextWithBailout(context, select);
42544254
};
42554255
}
42564256

@@ -4437,11 +4437,11 @@ if (__DEV__) {
44374437
(HooksDispatcherOnUpdateInDEV: Dispatcher).unstable_useContextWithBailout =
44384438
function <T>(
44394439
context: ReactContext<T>,
4440-
compare: (T => Array<mixed>) | null,
4440+
select: (T => Array<mixed>) | null,
44414441
): T {
44424442
currentHookNameInDev = 'useContext';
44434443
updateHookTypesDev();
4444-
return unstable_useContextWithBailout(context, compare);
4444+
return unstable_useContextWithBailout(context, select);
44454445
};
44464446
}
44474447

@@ -4628,11 +4628,11 @@ if (__DEV__) {
46284628
(HooksDispatcherOnUpdateInDEV: Dispatcher).unstable_useContextWithBailout =
46294629
function <T>(
46304630
context: ReactContext<T>,
4631-
compare: (T => Array<mixed>) | null,
4631+
select: (T => Array<mixed>) | null,
46324632
): T {
46334633
currentHookNameInDev = 'useContext';
46344634
updateHookTypesDev();
4635-
return unstable_useContextWithBailout(context, compare);
4635+
return unstable_useContextWithBailout(context, select);
46364636
};
46374637
}
46384638

@@ -4845,12 +4845,12 @@ if (__DEV__) {
48454845
(HooksDispatcherOnUpdateInDEV: Dispatcher).unstable_useContextWithBailout =
48464846
function <T>(
48474847
context: ReactContext<T>,
4848-
compare: (T => Array<mixed>) | null,
4848+
select: (T => Array<mixed>) | null,
48494849
): T {
48504850
currentHookNameInDev = 'useContext';
48514851
warnInvalidHookAccess();
48524852
mountHookTypesDev();
4853-
return unstable_useContextWithBailout(context, compare);
4853+
return unstable_useContextWithBailout(context, select);
48544854
};
48554855
}
48564856

@@ -5063,12 +5063,12 @@ if (__DEV__) {
50635063
(InvalidNestedHooksDispatcherOnUpdateInDEV: Dispatcher).unstable_useContextWithBailout =
50645064
function <T>(
50655065
context: ReactContext<T>,
5066-
compare: (T => Array<mixed>) | null,
5066+
select: (T => Array<mixed>) | null,
50675067
): T {
50685068
currentHookNameInDev = 'useContext';
50695069
warnInvalidHookAccess();
50705070
updateHookTypesDev();
5071-
return unstable_useContextWithBailout(context, compare);
5071+
return unstable_useContextWithBailout(context, select);
50725072
};
50735073
}
50745074

@@ -5281,12 +5281,12 @@ if (__DEV__) {
52815281
(InvalidNestedHooksDispatcherOnRerenderInDEV: Dispatcher).unstable_useContextWithBailout =
52825282
function <T>(
52835283
context: ReactContext<T>,
5284-
compare: (T => Array<mixed>) | null,
5284+
select: (T => Array<mixed>) | null,
52855285
): T {
52865286
currentHookNameInDev = 'useContext';
52875287
warnInvalidHookAccess();
52885288
updateHookTypesDev();
5289-
return unstable_useContextWithBailout(context, compare);
5289+
return unstable_useContextWithBailout(context, select);
52905290
};
52915291
}
52925292
}

packages/react-reconciler/src/ReactFiberNewContext.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ export function prepareToReadContext(
756756

757757
export function readContextAndCompare<C>(
758758
context: ReactContext<C>,
759-
compare: C => Array<mixed>,
759+
select: C => Array<mixed>,
760760
): C {
761761
if (!(enableLazyContextPropagation && enableContextProfiling)) {
762762
throw new Error('Not implemented.');
@@ -765,7 +765,7 @@ export function readContextAndCompare<C>(
765765
return readContextForConsumer_withSelect(
766766
currentlyRenderingFiber,
767767
context,
768-
compare,
768+
select,
769769
);
770770
}
771771

packages/react/src/ReactHooks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function useContext<T>(Context: ReactContext<T>): T {
7171

7272
export function unstable_useContextWithBailout<T>(
7373
context: ReactContext<T>,
74-
compare: (T => Array<mixed>) | null,
74+
select: (T => Array<mixed>) | null,
7575
): T {
7676
if (!(enableLazyContextPropagation && enableContextProfiling)) {
7777
throw new Error('Not implemented.');
@@ -87,7 +87,7 @@ export function unstable_useContextWithBailout<T>(
8787
}
8888
}
8989
// $FlowFixMe[not-a-function] This is unstable, thus optional
90-
return dispatcher.unstable_useContextWithBailout(context, compare);
90+
return dispatcher.unstable_useContextWithBailout(context, select);
9191
}
9292

9393
export function useState<S>(

0 commit comments

Comments
 (0)