Skip to content

Commit db708bb

Browse files
committed
flow+prettier
1 parent 57b7597 commit db708bb

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

packages/react-reconciler/src/ReactFiberHooks.new.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,7 +2424,7 @@ if (enableCache) {
24242424
}
24252425

24262426
if (enableServerContext) {
2427-
ContextOnlyDispatcher.useServerContext = throwInvalidHookError;
2427+
(ContextOnlyDispatcher: Dispatcher).useServerContext = throwInvalidHookError;
24282428
}
24292429

24302430
const HooksDispatcherOnMount: Dispatcher = {
@@ -2455,7 +2455,7 @@ if (enableCache) {
24552455
(HooksDispatcherOnMount: Dispatcher).useCacheRefresh = mountRefresh;
24562456
}
24572457
if (enableServerContext) {
2458-
HooksDispatcherOnMount.useServerContext = readContext;
2458+
(HooksDispatcherOnMount: Dispatcher).useServerContext = readContext;
24592459
}
24602460

24612461
const HooksDispatcherOnUpdate: Dispatcher = {
@@ -2486,7 +2486,7 @@ if (enableCache) {
24862486
(HooksDispatcherOnUpdate: Dispatcher).useCacheRefresh = updateRefresh;
24872487
}
24882488
if (enableServerContext) {
2489-
HooksDispatcherOnUpdate.useServerContext = readContext;
2489+
(HooksDispatcherOnUpdate: Dispatcher).useServerContext = readContext;
24902490
}
24912491

24922492
const HooksDispatcherOnRerender: Dispatcher = {
@@ -2517,7 +2517,7 @@ if (enableCache) {
25172517
(HooksDispatcherOnRerender: Dispatcher).useCacheRefresh = updateRefresh;
25182518
}
25192519
if (enableServerContext) {
2520-
HooksDispatcherOnRerender.useServerContext = readContext;
2520+
(HooksDispatcherOnRerender: Dispatcher).useServerContext = readContext;
25212521
}
25222522

25232523
let HooksDispatcherOnMountInDEV: Dispatcher | null = null;
@@ -2695,7 +2695,7 @@ if (__DEV__) {
26952695
};
26962696
}
26972697
if (enableServerContext) {
2698-
HooksDispatcherOnMountInDEV.useServerContext = mountServerContext;
2698+
(HooksDispatcherOnMountInDEV: Dispatcher).useServerContext = mountServerContext;
26992699
}
27002700

27012701
HooksDispatcherOnMountWithHookTypesInDEV = {
@@ -2840,7 +2840,7 @@ if (__DEV__) {
28402840
};
28412841
}
28422842
if (enableServerContext) {
2843-
HooksDispatcherOnMountWithHookTypesInDEV.useServerContext = updateServerContext;
2843+
(HooksDispatcherOnMountWithHookTypesInDEV: Dispatcher).useServerContext = updateServerContext;
28442844
}
28452845

28462846
HooksDispatcherOnUpdateInDEV = {
@@ -2985,7 +2985,7 @@ if (__DEV__) {
29852985
};
29862986
}
29872987
if (enableServerContext) {
2988-
HooksDispatcherOnUpdateInDEV.useServerContext = updateServerContext;
2988+
HooksDispatcherOnUpdateInDEV: Dispatcher = updateServerContext;
29892989
}
29902990

29912991
if (!enableServerContext) {
@@ -3297,7 +3297,7 @@ if (__DEV__) {
32973297
}
32983298

32993299
if (enableServerContext) {
3300-
InvalidNestedHooksDispatcherOnMountInDEV.useServerContext = <
3300+
(InvalidNestedHooksDispatcherOnMountInDEV: Dispatcher).useServerContext = <
33013301
T: ServerContextJSONValue,
33023302
>(
33033303
context: ReactServerContext<T>,
@@ -3471,7 +3471,7 @@ if (__DEV__) {
34713471
};
34723472
}
34733473
if (enableServerContext) {
3474-
InvalidNestedHooksDispatcherOnUpdateInDEV.useServerContext = <
3474+
(InvalidNestedHooksDispatcherOnUpdateInDEV: Dispatcher).useServerContext = <
34753475
T: ServerContextJSONValue,
34763476
>(
34773477
context: ReactServerContext<T>,
@@ -3646,7 +3646,7 @@ if (__DEV__) {
36463646
};
36473647
}
36483648
if (enableServerContext) {
3649-
InvalidNestedHooksDispatcherOnRerenderInDEV.useServerContext = <
3649+
(InvalidNestedHooksDispatcherOnRerenderInDEV: Dispatcher).useServerContext = <
36503650
T: ServerContextJSONValue,
36513651
>(
36523652
context: ReactServerContext<T>,

packages/react/src/ReactHooks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export function useServerContext<T: ServerContextJSONValue>(
189189
): T {
190190
// TODO: Warn if regular context is passed in
191191
const dispatcher = resolveDispatcher();
192+
// $FlowFixMe This is unstable, thus optional
192193
return dispatcher.useServerContext(Context);
193194
}
194195

packages/shared/getComponentNameFromType.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
*/
99

1010
import type {LazyComponent} from 'react/src/ReactLazy';
11-
import type {ReactContext, ReactServerContext, ReactProviderType} from 'shared/ReactTypes';
11+
import type {
12+
ReactContext,
13+
ReactServerContext,
14+
ReactProviderType,
15+
} from 'shared/ReactTypes';
1216

1317
import {
1418
REACT_CONTEXT_TYPE,

0 commit comments

Comments
 (0)