Create codemod for updating Toast calls to v2 (#10045)

This commit is contained in:
DS Boyce
2026-03-12 11:35:58 -07:00
committed by GitHub
parent 9c9970f680
commit 35cb2bcf94
62 changed files with 422 additions and 171 deletions
+7 -3
View File
@@ -7,7 +7,7 @@ import {
import {msg, plural} from '@lingui/core/macro'
import {STARTER_PACK_MAX_SIZE} from '#/lib/constants'
import * as Toast from '#/view/com/util/Toast'
import * as Toast from '#/components/Toast'
import * as bsky from '#/types/bsky'
const steps = ['Details', 'Profiles', 'Feeds'] as const
@@ -80,7 +80,9 @@ function reducer(state: State, action: Action): State {
msg`You may only add up to ${plural(STARTER_PACK_MAX_SIZE, {
other: `${STARTER_PACK_MAX_SIZE} profiles`,
})}`.message ?? '',
'info',
{
type: 'info',
},
)
} else {
updatedState = {...state, profiles: [...state.profiles, action.profile]}
@@ -96,7 +98,9 @@ function reducer(state: State, action: Action): State {
break
case 'AddFeed':
if (state.feeds.length >= 3) {
Toast.show(msg`You may only add up to 3 feeds`.message ?? '', 'info')
Toast.show(msg`You may only add up to 3 feeds`.message ?? '', {
type: 'info',
})
} else {
updatedState = {...state, feeds: [...state.feeds, action.feed]}
}
+7 -3
View File
@@ -40,7 +40,6 @@ import {
} from '#/state/queries/starter-packs'
import {useSession} from '#/state/session'
import {useSetMinimalShellMode} from '#/state/shell'
import * as Toast from '#/view/com/util/Toast'
import {UserAvatar} from '#/view/com/util/UserAvatar'
import {
useWizardState,
@@ -56,6 +55,7 @@ import * as Layout from '#/components/Layout'
import {ListMaybePlaceholder} from '#/components/Lists'
import {Loader} from '#/components/Loader'
import {WizardEditListDialog} from '#/components/StarterPack/Wizard/WizardEditListDialog'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {useAnalytics} from '#/analytics'
import {IS_NATIVE} from '#/env'
@@ -258,7 +258,9 @@ function WizardInner({
onError: e => {
logger.error('Failed to create starter pack', {safeMessage: e})
dispatch({type: 'SetProcessing', processing: false})
Toast.show(_(msg`Failed to create starter pack`), 'xmark')
Toast.show(_(msg`Failed to create starter pack`), {
type: 'error',
})
},
})
const {mutate: editStarterPack} = useEditStarterPackMutation({
@@ -266,7 +268,9 @@ function WizardInner({
onError: e => {
logger.error('Failed to edit starter pack', {safeMessage: e})
dispatch({type: 'SetProcessing', processing: false})
Toast.show(_(msg`Failed to create starter pack`), 'xmark')
Toast.show(_(msg`Failed to create starter pack`), {
type: 'error',
})
},
})