Skip to content

Commit 3b83783

Browse files
author
Sebastian Silbermann
committed
No try-finally for consistency
1 parent f6d0c63 commit 3b83783

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

packages/react-reconciler/src/ReactFiberHooks.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,11 +1160,8 @@ function mountReducer<S, I, A>(
11601160
initialState = init(initialArg);
11611161
if (shouldDoubleInvokeUserFnsInHooksDEV) {
11621162
setIsStrictModeForDevtools(true);
1163-
try {
1164-
init(initialArg);
1165-
} finally {
1166-
setIsStrictModeForDevtools(false);
1167-
}
1163+
init(initialArg);
1164+
setIsStrictModeForDevtools(false);
11681165
}
11691166
} else {
11701167
initialState = ((initialArg: any): S);
@@ -1762,12 +1759,9 @@ function mountStateImpl<S>(initialState: (() => S) | S): Hook {
17621759
initialState = initialStateInitializer();
17631760
if (shouldDoubleInvokeUserFnsInHooksDEV) {
17641761
setIsStrictModeForDevtools(true);
1765-
try {
1766-
// $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
1767-
initialStateInitializer();
1768-
} finally {
1769-
setIsStrictModeForDevtools(false);
1770-
}
1762+
// $FlowFixMe[incompatible-use]: Flow doesn't like mixed types
1763+
initialStateInitializer();
1764+
setIsStrictModeForDevtools(false);
17711765
}
17721766
}
17731767
hook.memoizedState = hook.baseState = initialState;

0 commit comments

Comments
 (0)