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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user