Unblock React Compiler for 18 components with value blocks inside try (#11548)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tomasz Zawadzki
2026-08-31 15:47:42 +02:00
committed by GitHub
parent 80d09a242d
commit 8bf5696d3c
18 changed files with 179 additions and 85 deletions
@@ -221,6 +221,16 @@ function DialogInner({
const onPressSave = useCallback(async () => {
setImageError('')
setDisplayNameTooShort(false)
/*
* Hoisted above the `try`: React Compiler cannot lower a conditional
* expression inside one.
*/
const updatedMessage = isCurateList
? _(msg({message: 'User list updated', context: 'toast'}))
: _(msg({message: 'Moderation list updated', context: 'toast'}))
const createdMessage = isCurateList
? _(msg({message: 'User list created', context: 'toast'}))
: _(msg({message: 'Moderation list created', context: 'toast'}))
try {
if (displayName.length === 0) {
setDisplayNameTooShort(true)
@@ -244,11 +254,7 @@ function DialogInner({
descriptionFacets: richText.facets,
avatar: newListAvatar,
})
Toast.show(
isCurateList
? _(msg({message: 'User list updated', context: 'toast'}))
: _(msg({message: 'Moderation list updated', context: 'toast'})),
)
Toast.show(updatedMessage)
control.close(() => onSave?.(list.uri))
} else {
const {uri} = await createListMutation({
@@ -258,11 +264,7 @@ function DialogInner({
descriptionFacets: richText.facets,
avatar: newListAvatar,
})
Toast.show(
isCurateList
? _(msg({message: 'User list created', context: 'toast'}))
: _(msg({message: 'Moderation list created', context: 'toast'})),
)
Toast.show(createdMessage)
control.close(() => onSave?.(uri))
}
} catch (e: any) {