From fd0a99b2ab3240e817e34e9d2205286c90d4840d Mon Sep 17 00:00:00 2001 From: Lizaveta Miasayedava Date: Mon, 16 Mar 2026 18:47:29 +0000 Subject: [PATCH] fix(widget): handle failed execution state with no failed actions --- packages/widget/src/components/Step/Step.tsx | 30 +++++++++++++++---- .../widget/src/components/Step/StepAction.tsx | 2 +- .../TransactionPage/StatusBottomSheet.tsx | 9 ++++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/packages/widget/src/components/Step/Step.tsx b/packages/widget/src/components/Step/Step.tsx index 01ae3554a..4ab8cd5ac 100644 --- a/packages/widget/src/components/Step/Step.tsx +++ b/packages/widget/src/components/Step/Step.tsx @@ -1,4 +1,8 @@ -import type { LiFiStepExtended, TokenAmount } from '@lifi/sdk' +import type { + ExecutionActionType, + LiFiStepExtended, + TokenAmount, +} from '@lifi/sdk' import { Box } from '@mui/material' import { useTranslation } from 'react-i18next' import { Card } from '../../components/Card/Card.js' @@ -23,9 +27,13 @@ export const Step: React.FC<{ const { t } = useTranslation() const { subvariant, subvariantOptions } = useWidgetConfig() const { getAddressLink } = useExplorer() - const stepHasError = step.execution?.actions?.some( - (action) => action.status === 'FAILED' - ) + + // If execution status is failed outside of actions scope, + // show a synthetic action to represent the failed execution + const actions = step.execution?.actions ?? [] + const failedWithoutActions = + step.execution?.status === 'FAILED' && + !actions.some((a) => a.status === 'FAILED') const getCardTitle = () => { const hasBridgeStep = step.includedSteps.some( @@ -72,7 +80,7 @@ export const Step: React.FC<{ : undefined return ( - + ) )} + {failedWithoutActions ? ( + + ) : null} {formattedToAddress && toAddressLink ? ( {title} diff --git a/packages/widget/src/pages/TransactionPage/StatusBottomSheet.tsx b/packages/widget/src/pages/TransactionPage/StatusBottomSheet.tsx index 2a0b2ade6..74745b0be 100644 --- a/packages/widget/src/pages/TransactionPage/StatusBottomSheet.tsx +++ b/packages/widget/src/pages/TransactionPage/StatusBottomSheet.tsx @@ -1,3 +1,4 @@ +import type { ExecutionActionType } from '@lifi/sdk' import Done from '@mui/icons-material/Done' import ErrorRounded from '@mui/icons-material/ErrorRounded' import InfoRounded from '@mui/icons-material/InfoRounded' @@ -184,9 +185,13 @@ const StatusBottomSheetContent: React.FC = ({ if (!step) { break } - const action = step.execution?.actions.find( + const action = step.execution?.actions?.find( (action) => action.status === 'FAILED' - ) + ) || { + status: 'FAILED', + type: 'EXECUTION' as ExecutionActionType, + error: step.execution?.error, + } // synthetic action to represent a failed execution with no actions const actionMessage = getErrorMessage(t, getChainById, step, action) title = actionMessage.title failedMessage = actionMessage.message