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:
+1
-2
@@ -126,9 +126,8 @@ function InnerApp() {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn(`session: resume failed`, {message: e})
|
logger.warn(`session: resume failed`, {message: e})
|
||||||
} finally {
|
|
||||||
setIsReady(true)
|
|
||||||
}
|
}
|
||||||
|
setIsReady(true)
|
||||||
}
|
}
|
||||||
const account = readLastActiveAccount()
|
const account = readLastActiveAccount()
|
||||||
void onLaunch(account)
|
void onLaunch(account)
|
||||||
|
|||||||
+1
-2
@@ -105,9 +105,8 @@ function InnerApp() {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn('session: resumeSession failed', {message: e})
|
logger.warn('session: resumeSession failed', {message: e})
|
||||||
} finally {
|
|
||||||
setIsReady(true)
|
|
||||||
}
|
}
|
||||||
|
setIsReady(true)
|
||||||
}
|
}
|
||||||
const account = readLastActiveAccount()
|
const account = readLastActiveAccount()
|
||||||
void onLaunch(account)
|
void onLaunch(account)
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ let PostMenuItems = ({
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} finally {
|
}
|
||||||
ax.metric('postMenu:blockAccount', {
|
ax.metric('postMenu:blockAccount', {
|
||||||
uri: postUri,
|
uri: postUri,
|
||||||
authorDid: postAuthor.did,
|
authorDid: postAuthor.did,
|
||||||
@@ -437,7 +437,6 @@ let PostMenuItems = ({
|
|||||||
feedDescriptor: feedFeedback.feedDescriptor,
|
feedDescriptor: feedFeedback.feedDescriptor,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const onMuteAuthor = async () => {
|
const onMuteAuthor = async () => {
|
||||||
if (postAuthor.viewer?.muted) {
|
if (postAuthor.viewer?.muted) {
|
||||||
@@ -452,14 +451,13 @@ let PostMenuItems = ({
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} finally {
|
}
|
||||||
ax.metric('postMenu:unmuteAccount', {
|
ax.metric('postMenu:unmuteAccount', {
|
||||||
uri: postUri,
|
uri: postUri,
|
||||||
authorDid: postAuthor.did,
|
authorDid: postAuthor.did,
|
||||||
logContext,
|
logContext,
|
||||||
feedDescriptor: feedFeedback.feedDescriptor,
|
feedDescriptor: feedFeedback.feedDescriptor,
|
||||||
})
|
})
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
await queueMute()
|
await queueMute()
|
||||||
@@ -472,7 +470,7 @@ let PostMenuItems = ({
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} finally {
|
}
|
||||||
ax.metric('postMenu:muteAccount', {
|
ax.metric('postMenu:muteAccount', {
|
||||||
uri: postUri,
|
uri: postUri,
|
||||||
authorDid: postAuthor.did,
|
authorDid: postAuthor.did,
|
||||||
@@ -481,7 +479,6 @@ let PostMenuItems = ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const onReportMisclassification = () => {
|
const onReportMisclassification = () => {
|
||||||
const url = `https://docs.google.com/forms/d/e/1FAIpQLSd0QPqhNFksDQf1YyOos7r1ofCLvmrKAH1lU042TaS3GAZaWQ/viewform?entry.1756031717=${toShareUrl(
|
const url = `https://docs.google.com/forms/d/e/1FAIpQLSd0QPqhNFksDQf1YyOos7r1ofCLvmrKAH1lU042TaS3GAZaWQ/viewform?entry.1756031717=${toShareUrl(
|
||||||
|
|||||||
@@ -95,9 +95,8 @@ function DeviceLocationRequestDialogInner({onLocationAcquired}: Props) {
|
|||||||
safeMessage: e.message,
|
safeMessage: e.message,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
setIsRequesting(false)
|
|
||||||
}
|
}
|
||||||
|
setIsRequesting(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -241,9 +241,8 @@ export function PostInteractionSettingsDialogControlledInner(
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} finally {
|
|
||||||
setIsSaving(false)
|
|
||||||
}
|
}
|
||||||
|
setIsSaving(false)
|
||||||
}, [
|
}, [
|
||||||
_,
|
_,
|
||||||
ax,
|
ax,
|
||||||
|
|||||||
@@ -319,9 +319,8 @@ function Inner(
|
|||||||
type: 'setError',
|
type: 'setError',
|
||||||
error,
|
error,
|
||||||
})
|
})
|
||||||
} finally {
|
|
||||||
setIsPending(false)
|
|
||||||
}
|
}
|
||||||
|
setIsPending(false)
|
||||||
}, [logger, submitReport, props, state, ax, l, videoTimestampSeconds])
|
}, [logger, submitReport, props, state, ax, l, videoTimestampSeconds])
|
||||||
|
|
||||||
useCallOnce(() => {
|
useCallOnce(() => {
|
||||||
|
|||||||
@@ -54,9 +54,8 @@ export function useAccountSwitcher() {
|
|||||||
Toast.show(_(msg`Please sign in as @${account.handle}`), {
|
Toast.show(_(msg`Please sign in as @${account.handle}`), {
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
} finally {
|
|
||||||
setPendingDid(null)
|
|
||||||
}
|
}
|
||||||
|
setPendingDid(null)
|
||||||
},
|
},
|
||||||
[_, ax, resumeSession, requestSwitchToAccount, pendingDid],
|
[_, ax, resumeSession, requestSwitchToAccount, pendingDid],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -95,9 +95,8 @@ export function Deactivated() {
|
|||||||
logger.error(e, {
|
logger.error(e, {
|
||||||
message: 'Failed to activate account',
|
message: 'Failed to activate account',
|
||||||
})
|
})
|
||||||
} finally {
|
|
||||||
setPending(false)
|
|
||||||
}
|
}
|
||||||
|
setPending(false)
|
||||||
}, [_, pdsClient, refreshSession, setPending, setError, queryClient])
|
}, [_, pdsClient, refreshSession, setPending, setError, queryClient])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -103,9 +103,8 @@ export function ListHiddenScreen({
|
|||||||
msg`There was an issue. Please check your internet connection and try again.`,
|
msg`There was an issue. Please check your internet connection and try again.`,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
} finally {
|
|
||||||
setIsProcessing(false)
|
|
||||||
}
|
}
|
||||||
|
setIsProcessing(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -58,9 +58,8 @@ export const ChooseAccountForm = ({
|
|||||||
})
|
})
|
||||||
// Move to login form.
|
// Move to login form.
|
||||||
onSelectAccount(account)
|
onSelectAccount(account)
|
||||||
} finally {
|
|
||||||
setPendingDid(null)
|
|
||||||
}
|
}
|
||||||
|
setPendingDid(null)
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
currentAccount,
|
currentAccount,
|
||||||
|
|||||||
@@ -102,9 +102,8 @@ function Inner() {
|
|||||||
logger.error('Failed to request password reset', {safeMessage: e})
|
logger.error('Failed to request password reset', {safeMessage: e})
|
||||||
setError(cleanError(e))
|
setError(cleanError(e))
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
setIsProcessing(false)
|
|
||||||
}
|
}
|
||||||
|
setIsProcessing(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangePassword = async () => {
|
const onChangePassword = async () => {
|
||||||
@@ -151,9 +150,8 @@ function Inner() {
|
|||||||
logger.error('Failed to set new password', {safeMessage: e})
|
logger.error('Failed to set new password', {safeMessage: e})
|
||||||
setError(cleanError(e))
|
setError(cleanError(e))
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
setIsProcessing(false)
|
|
||||||
}
|
}
|
||||||
|
setIsProcessing(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onBlur = () => {
|
const onBlur = () => {
|
||||||
|
|||||||
@@ -64,9 +64,8 @@ function DeactivateAccountDialogInner({
|
|||||||
logger.error(e, {
|
logger.error(e, {
|
||||||
message: 'Failed to deactivate account',
|
message: 'Failed to deactivate account',
|
||||||
})
|
})
|
||||||
} finally {
|
|
||||||
setPending(false)
|
|
||||||
}
|
}
|
||||||
|
setPending(false)
|
||||||
}, [client, control, logoutCurrentAccount, _, setPending])
|
}, [client, control, logoutCurrentAccount, _, setPending])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -49,9 +49,8 @@ export function DisableEmail2FADialog({
|
|||||||
setStage(Stages.ConfirmCode)
|
setStage(Stages.ConfirmCode)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(cleanError(String(e)))
|
setError(cleanError(String(e)))
|
||||||
} finally {
|
|
||||||
setIsProcessing(false)
|
|
||||||
}
|
}
|
||||||
|
setIsProcessing(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onConfirmDisable = async () => {
|
const onConfirmDisable = async () => {
|
||||||
@@ -80,9 +79,8 @@ export function DisableEmail2FADialog({
|
|||||||
} else {
|
} else {
|
||||||
setError(cleanError(e))
|
setError(cleanError(e))
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
setIsProcessing(false)
|
|
||||||
}
|
}
|
||||||
|
setIsProcessing(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -53,9 +53,8 @@ export function ExportCarDialog({
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error('Error occurred while downloading CAR file', {message: e})
|
logger.error('Error occurred while downloading CAR file', {message: e})
|
||||||
Toast.show(l`Error occurred while saving file`, {type: 'error'})
|
Toast.show(l`Error occurred while saving file`, {type: 'error'})
|
||||||
} finally {
|
|
||||||
setLoading(false)
|
|
||||||
}
|
}
|
||||||
|
setLoading(false)
|
||||||
}, [l, currentAccount, pdsClient])
|
}, [l, currentAccount, pdsClient])
|
||||||
|
|
||||||
const downloadChatData = useCallback(async () => {
|
const downloadChatData = useCallback(async () => {
|
||||||
@@ -84,9 +83,8 @@ export function ExportCarDialog({
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error('Error occurred while downloading chat data', {message: e})
|
logger.error('Error occurred while downloading chat data', {message: e})
|
||||||
Toast.show(l`Error occurred while saving file`, {type: 'error'})
|
Toast.show(l`Error occurred while saving file`, {type: 'error'})
|
||||||
} finally {
|
|
||||||
setLoading(false)
|
|
||||||
}
|
}
|
||||||
|
setLoading(false)
|
||||||
}, [l, currentAccount, chatClient])
|
}, [l, currentAccount, chatClient])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -51,9 +51,8 @@ export function StepCaptchaNative() {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
const e = err as Error
|
const e = err as Error
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
} finally {
|
|
||||||
setReady(true)
|
|
||||||
}
|
}
|
||||||
|
setReady(true)
|
||||||
})()
|
})()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,8 @@ export function SignupQueued() {
|
|||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
logger.error('Failed to check signup queue', {err: e.toString()})
|
logger.error('Failed to check signup queue', {err: e.toString()})
|
||||||
} finally {
|
|
||||||
setProcessing(false)
|
|
||||||
}
|
}
|
||||||
|
setProcessing(false)
|
||||||
}, [
|
}, [
|
||||||
setProcessing,
|
setProcessing,
|
||||||
setEstimatedTime,
|
setEstimatedTime,
|
||||||
|
|||||||
@@ -103,9 +103,8 @@ export function NotificationFeed({
|
|||||||
logger.error('Failed to refresh notifications feed', {
|
logger.error('Failed to refresh notifications feed', {
|
||||||
message: err,
|
message: err,
|
||||||
})
|
})
|
||||||
} finally {
|
|
||||||
setIsPTRing(false)
|
|
||||||
}
|
}
|
||||||
|
setIsPTRing(false)
|
||||||
}, [refreshNotifications, setIsPTRing])
|
}, [refreshNotifications, setIsPTRing])
|
||||||
|
|
||||||
const onEndReached = useCallback(async () => {
|
const onEndReached = useCallback(async () => {
|
||||||
|
|||||||
@@ -920,9 +920,8 @@ function SayHelloBtn({profile}: {profile: app.bsky.actor.defs.ProfileView}) {
|
|||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error('Failed to get conversation', {safeMessage: e})
|
logger.error('Failed to get conversation', {safeMessage: e})
|
||||||
} finally {
|
|
||||||
setIsLoading(false)
|
|
||||||
}
|
}
|
||||||
|
setIsLoading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -559,9 +559,8 @@ function ComposeBtn({minimal}: {minimal: boolean}) {
|
|||||||
handle = await fetchHandle(handle)
|
handle = await fetchHandle(handle)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
handle = undefined
|
handle = undefined
|
||||||
} finally {
|
|
||||||
setIsFetchingHandle(false)
|
|
||||||
}
|
}
|
||||||
|
setIsFetchingHandle(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user