Unblock React Compiler for 13 components by hoisting finally blocks
React Compiler cannot lower a `finally` block, so every component containing
one is skipped entirely. In these 24 sites the `catch` completes normally and
neither block returns or throws, which makes `finally { cleanup() }` exactly
equivalent to running `cleanup()` after the try/catch.
Sites with no `catch` are left alone - there the cleanup also runs on the throw
path, so hoisting it would change behavior.
Skipped components: 125 -> 112.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -95,9 +95,8 @@ export function Deactivated() {
|
||||
logger.error(e, {
|
||||
message: 'Failed to activate account',
|
||||
})
|
||||
} finally {
|
||||
setPending(false)
|
||||
}
|
||||
setPending(false)
|
||||
}, [_, pdsClient, refreshSession, setPending, setError, queryClient])
|
||||
|
||||
return (
|
||||
|
||||
@@ -103,9 +103,8 @@ export function ListHiddenScreen({
|
||||
msg`There was an issue. Please check your internet connection and try again.`,
|
||||
),
|
||||
)
|
||||
} finally {
|
||||
setIsProcessing(false)
|
||||
}
|
||||
setIsProcessing(false)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -58,9 +58,8 @@ export const ChooseAccountForm = ({
|
||||
})
|
||||
// Move to login form.
|
||||
onSelectAccount(account)
|
||||
} finally {
|
||||
setPendingDid(null)
|
||||
}
|
||||
setPendingDid(null)
|
||||
},
|
||||
[
|
||||
currentAccount,
|
||||
|
||||
@@ -102,9 +102,8 @@ function Inner() {
|
||||
logger.error('Failed to request password reset', {safeMessage: e})
|
||||
setError(cleanError(e))
|
||||
}
|
||||
} finally {
|
||||
setIsProcessing(false)
|
||||
}
|
||||
setIsProcessing(false)
|
||||
}
|
||||
|
||||
const onChangePassword = async () => {
|
||||
@@ -151,9 +150,8 @@ function Inner() {
|
||||
logger.error('Failed to set new password', {safeMessage: e})
|
||||
setError(cleanError(e))
|
||||
}
|
||||
} finally {
|
||||
setIsProcessing(false)
|
||||
}
|
||||
setIsProcessing(false)
|
||||
}
|
||||
|
||||
const onBlur = () => {
|
||||
|
||||
@@ -64,9 +64,8 @@ function DeactivateAccountDialogInner({
|
||||
logger.error(e, {
|
||||
message: 'Failed to deactivate account',
|
||||
})
|
||||
} finally {
|
||||
setPending(false)
|
||||
}
|
||||
setPending(false)
|
||||
}, [client, control, logoutCurrentAccount, _, setPending])
|
||||
|
||||
return (
|
||||
|
||||
@@ -49,9 +49,8 @@ export function DisableEmail2FADialog({
|
||||
setStage(Stages.ConfirmCode)
|
||||
} catch (e) {
|
||||
setError(cleanError(String(e)))
|
||||
} finally {
|
||||
setIsProcessing(false)
|
||||
}
|
||||
setIsProcessing(false)
|
||||
}
|
||||
|
||||
const onConfirmDisable = async () => {
|
||||
@@ -80,9 +79,8 @@ export function DisableEmail2FADialog({
|
||||
} else {
|
||||
setError(cleanError(e))
|
||||
}
|
||||
} finally {
|
||||
setIsProcessing(false)
|
||||
}
|
||||
setIsProcessing(false)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -53,9 +53,8 @@ export function ExportCarDialog({
|
||||
} catch (e) {
|
||||
logger.error('Error occurred while downloading CAR file', {message: e})
|
||||
Toast.show(l`Error occurred while saving file`, {type: 'error'})
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
setLoading(false)
|
||||
}, [l, currentAccount, pdsClient])
|
||||
|
||||
const downloadChatData = useCallback(async () => {
|
||||
@@ -84,9 +83,8 @@ export function ExportCarDialog({
|
||||
} catch (e) {
|
||||
logger.error('Error occurred while downloading chat data', {message: e})
|
||||
Toast.show(l`Error occurred while saving file`, {type: 'error'})
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
setLoading(false)
|
||||
}, [l, currentAccount, chatClient])
|
||||
|
||||
return (
|
||||
|
||||
@@ -51,9 +51,8 @@ export function StepCaptchaNative() {
|
||||
} catch (err) {
|
||||
const e = err as Error
|
||||
logger.error(e)
|
||||
} finally {
|
||||
setReady(true)
|
||||
}
|
||||
setReady(true)
|
||||
})()
|
||||
}, [])
|
||||
|
||||
|
||||
@@ -60,9 +60,8 @@ export function SignupQueued() {
|
||||
}
|
||||
} catch (e: any) {
|
||||
logger.error('Failed to check signup queue', {err: e.toString()})
|
||||
} finally {
|
||||
setProcessing(false)
|
||||
}
|
||||
setProcessing(false)
|
||||
}, [
|
||||
setProcessing,
|
||||
setEstimatedTime,
|
||||
|
||||
Reference in New Issue
Block a user