Skip to content

Commit d70d7ac

Browse files
committed
Make cleanup function optional
1 parent 022a4b9 commit d70d7ac

File tree

9 files changed

+12
-17
lines changed

9 files changed

+12
-17
lines changed

packages/react-art/src/ReactART.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {TYPES, childrenAsString} from './ReactARTInternals';
2727

2828
function defaultOnDefaultTransitionIndicator() {
2929
// Noop
30-
return function () {};
3130
}
3231

3332
Mode.setCurrent(

packages/react-dom/src/client/ReactDOMRoot.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export type CreateRootOptions = {
4646
error: mixed,
4747
errorInfo: {+componentStack?: ?string},
4848
) => void,
49-
onDefaultTransitionIndicator?: () => () => void,
49+
onDefaultTransitionIndicator?: () => void | (() => void),
5050
};
5151

5252
export type HydrateRootOptions = {
@@ -72,7 +72,7 @@ export type HydrateRootOptions = {
7272
error: mixed,
7373
errorInfo: {+componentStack?: ?string},
7474
) => void,
75-
onDefaultTransitionIndicator?: () => () => void,
75+
onDefaultTransitionIndicator?: () => void | (() => void),
7676
formState?: ReactFormState<any, any> | null,
7777
};
7878

@@ -97,7 +97,7 @@ import {
9797
} from 'react-reconciler/src/ReactFiberReconciler';
9898
import {ConcurrentRoot} from 'react-reconciler/src/ReactRootTags';
9999

100-
function defaultOnDefaultTransitionIndicator() {
100+
function defaultOnDefaultTransitionIndicator(): void | (() => void) {
101101
// TODO: Implement the default
102102
return function () {};
103103
}

packages/react-native-renderer/src/ReactFabric.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ function nativeOnCaughtError(
9898

9999
defaultOnCaughtError(error, errorInfo);
100100
}
101-
function nativeOnDefaultTransitionIndicator() {
101+
function nativeOnDefaultTransitionIndicator(): void | (() => void) {
102102
// Native doesn't have a default indicator.
103-
return function () {};
104103
}
105104

106105
function render(

packages/react-native-renderer/src/ReactNativeRenderer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ function nativeOnCaughtError(
113113

114114
defaultOnCaughtError(error, errorInfo);
115115
}
116-
function nativeOnDefaultTransitionIndicator() {
116+
function nativeOnDefaultTransitionIndicator(): void | (() => void) {
117117
// Native doesn't have a default indicator.
118-
return function () {};
119118
}
120119

121120
function render(

packages/react-noop-renderer/src/createReactNoop.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ type CreateRootOptions = {
8080
unstable_transitionCallbacks?: TransitionTracingCallbacks,
8181
onUncaughtError?: (error: mixed, errorInfo: {componentStack: string}) => void,
8282
onCaughtError?: (error: mixed, errorInfo: {componentStack: string}) => void,
83-
onDefaultTransitionIndicator?: () => () => void,
83+
onDefaultTransitionIndicator?: () => void | (() => void),
8484
...
8585
};
8686
type InstanceMeasurement = null;
@@ -1142,9 +1142,8 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
11421142
// TODO: Turn this on once tests are fixed
11431143
// console.error(error);
11441144
}
1145-
function onDefaultTransitionIndicator() {
1145+
function onDefaultTransitionIndicator(): void | (() => void) {
11461146
// TODO: Allow this as an option.
1147-
return function () {};
11481147
}
11491148

11501149
let idCounter = 0;

packages/react-reconciler/src/ReactFiberReconciler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export function createContainer(
254254
error: mixed,
255255
errorInfo: {+componentStack?: ?string},
256256
) => void,
257-
onDefaultTransitionIndicator: () => () => void,
257+
onDefaultTransitionIndicator: () => void | (() => void),
258258
transitionCallbacks: null | TransitionTracingCallbacks,
259259
): OpaqueRoot {
260260
const hydrate = false;
@@ -302,7 +302,7 @@ export function createHydrationContainer(
302302
error: mixed,
303303
errorInfo: {+componentStack?: ?string},
304304
) => void,
305-
onDefaultTransitionIndicator: () => () => void,
305+
onDefaultTransitionIndicator: () => void | (() => void),
306306
transitionCallbacks: null | TransitionTracingCallbacks,
307307
formState: ReactFormState<any, any> | null,
308308
): OpaqueRoot {

packages/react-reconciler/src/ReactFiberRoot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export function createFiberRoot(
179179
error: mixed,
180180
errorInfo: {+componentStack?: ?string},
181181
) => void,
182-
onDefaultTransitionIndicator: () => () => void,
182+
onDefaultTransitionIndicator: () => void | (() => void),
183183
transitionCallbacks: null | TransitionTracingCallbacks,
184184
): FiberRoot {
185185
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions

packages/react-reconciler/src/ReactInternalTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ type BaseFiberRootProperties = {
280280
errorInfo: {+componentStack?: ?string},
281281
) => void,
282282

283-
onDefaultTransitionIndicator: () => () => void,
283+
onDefaultTransitionIndicator: () => void | (() => void),
284284

285285
formState: ReactFormState<any, any> | null,
286286

packages/react-test-renderer/src/ReactTestRenderer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ import {
6060
disableLegacyMode,
6161
} from 'shared/ReactFeatureFlags';
6262

63-
function defaultOnDefaultTransitionIndicator() {
63+
function defaultOnDefaultTransitionIndicator(): void | (() => void) {
6464
// Noop
65-
return function () {};
6665
}
6766

6867
// $FlowFixMe[prop-missing]: This is only in the development export.

0 commit comments

Comments
 (0)