Skip to content

Commit

Permalink
flow+prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
salazarm committed Feb 14, 2022
1 parent 57b7597 commit db708bb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
20 changes: 10 additions & 10 deletions packages/react-reconciler/src/ReactFiberHooks.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -2424,7 +2424,7 @@ if (enableCache) {
}

if (enableServerContext) {
ContextOnlyDispatcher.useServerContext = throwInvalidHookError;
(ContextOnlyDispatcher: Dispatcher).useServerContext = throwInvalidHookError;
}

const HooksDispatcherOnMount: Dispatcher = {
Expand Down Expand Up @@ -2455,7 +2455,7 @@ if (enableCache) {
(HooksDispatcherOnMount: Dispatcher).useCacheRefresh = mountRefresh;
}
if (enableServerContext) {
HooksDispatcherOnMount.useServerContext = readContext;
(HooksDispatcherOnMount: Dispatcher).useServerContext = readContext;
}

const HooksDispatcherOnUpdate: Dispatcher = {
Expand Down Expand Up @@ -2486,7 +2486,7 @@ if (enableCache) {
(HooksDispatcherOnUpdate: Dispatcher).useCacheRefresh = updateRefresh;
}
if (enableServerContext) {
HooksDispatcherOnUpdate.useServerContext = readContext;
(HooksDispatcherOnUpdate: Dispatcher).useServerContext = readContext;
}

const HooksDispatcherOnRerender: Dispatcher = {
Expand Down Expand Up @@ -2517,7 +2517,7 @@ if (enableCache) {
(HooksDispatcherOnRerender: Dispatcher).useCacheRefresh = updateRefresh;
}
if (enableServerContext) {
HooksDispatcherOnRerender.useServerContext = readContext;
(HooksDispatcherOnRerender: Dispatcher).useServerContext = readContext;
}

let HooksDispatcherOnMountInDEV: Dispatcher | null = null;
Expand Down Expand Up @@ -2695,7 +2695,7 @@ if (__DEV__) {
};
}
if (enableServerContext) {
HooksDispatcherOnMountInDEV.useServerContext = mountServerContext;
(HooksDispatcherOnMountInDEV: Dispatcher).useServerContext = mountServerContext;
}

HooksDispatcherOnMountWithHookTypesInDEV = {
Expand Down Expand Up @@ -2840,7 +2840,7 @@ if (__DEV__) {
};
}
if (enableServerContext) {
HooksDispatcherOnMountWithHookTypesInDEV.useServerContext = updateServerContext;
(HooksDispatcherOnMountWithHookTypesInDEV: Dispatcher).useServerContext = updateServerContext;
}

HooksDispatcherOnUpdateInDEV = {
Expand Down Expand Up @@ -2985,7 +2985,7 @@ if (__DEV__) {
};
}
if (enableServerContext) {
HooksDispatcherOnUpdateInDEV.useServerContext = updateServerContext;
HooksDispatcherOnUpdateInDEV: Dispatcher = updateServerContext;
}

if (!enableServerContext) {
Expand Down Expand Up @@ -3297,7 +3297,7 @@ if (__DEV__) {
}

if (enableServerContext) {
InvalidNestedHooksDispatcherOnMountInDEV.useServerContext = <
(InvalidNestedHooksDispatcherOnMountInDEV: Dispatcher).useServerContext = <
T: ServerContextJSONValue,
>(
context: ReactServerContext<T>,
Expand Down Expand Up @@ -3471,7 +3471,7 @@ if (__DEV__) {
};
}
if (enableServerContext) {
InvalidNestedHooksDispatcherOnUpdateInDEV.useServerContext = <
(InvalidNestedHooksDispatcherOnUpdateInDEV: Dispatcher).useServerContext = <
T: ServerContextJSONValue,
>(
context: ReactServerContext<T>,
Expand Down Expand Up @@ -3646,7 +3646,7 @@ if (__DEV__) {
};
}
if (enableServerContext) {
InvalidNestedHooksDispatcherOnRerenderInDEV.useServerContext = <
(InvalidNestedHooksDispatcherOnRerenderInDEV: Dispatcher).useServerContext = <
T: ServerContextJSONValue,
>(
context: ReactServerContext<T>,
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/ReactHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export function useServerContext<T: ServerContextJSONValue>(
): T {
// TODO: Warn if regular context is passed in
const dispatcher = resolveDispatcher();
// $FlowFixMe This is unstable, thus optional
return dispatcher.useServerContext(Context);
}

Expand Down
6 changes: 5 additions & 1 deletion packages/shared/getComponentNameFromType.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
*/

import type {LazyComponent} from 'react/src/ReactLazy';
import type {ReactContext, ReactServerContext, ReactProviderType} from 'shared/ReactTypes';
import type {
ReactContext,
ReactServerContext,
ReactProviderType,
} from 'shared/ReactTypes';

import {
REACT_CONTEXT_TYPE,
Expand Down

0 comments on commit db708bb

Please sign in to comment.