Unblock React Compiler for 6 components with try/finally that cannot hoist

The earlier pass moved `finally` bodies below the try/catch, which is only
valid when a `catch` completes normally. These are the leftovers.

Where the catch does complete normally but a nested callback happened to
contain a `return`, the same hoist applies after all - InterestsSettings and
DeleteAccountDialog were false positives in the first pass's scan.

Where there is no `catch`, the cleanup has to survive the throw path, so the
try/finally moves into `withCleanup` at module scope instead. Same semantics,
outside the compiled function.

Skipped components: 125 -> 119.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tomek Zawadzki
2026-08-25 16:31:59 +02:00
parent f87fdd2ea2
commit dfa98d5946
8 changed files with 152 additions and 106 deletions
@@ -2,6 +2,7 @@ import {useState} from 'react'
import {Trans, useLingui} from '@lingui/react/macro'
import {wait} from '#/lib/async/wait'
import {withCleanup} from '#/lib/async/withCleanup'
import {atoms as a, type TextStyleProp, useTheme} from '#/alf'
import {CheckThick_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check'
import {createStaticClick, InlineLinkText} from '#/components/Link'
@@ -20,14 +21,17 @@ export function ResendEmailText({
const handleOnPress = async () => {
setStatus('sending')
try {
await wait(1000, onPress())
setStatus('success')
} finally {
setTimeout(() => {
setStatus(null)
}, 1000)
}
await withCleanup(
async () => {
await wait(1000, onPress())
setStatus('success')
},
() => {
setTimeout(() => {
setStatus(null)
}, 1000)
},
)
}
return (