fix(checkout-widgets): Ensure error view is shown when sale processing fails#2805
Merged
JCSanPedro merged 4 commits intomainfrom Mar 20, 2026
Merged
fix(checkout-widgets): Ensure error view is shown when sale processing fails#2805JCSanPedro merged 4 commits intomainfrom
JCSanPedro merged 4 commits intomainfrom
Conversation
…ror view when fetching funding balances fails
|
View your CI Pipeline Execution ↗ for commit 66c91ca
☁️ Nx Cloud last updated this comment at |
| }); | ||
|
|
||
| // eslint-disable-next-line no-console | ||
| console.error('[IMTBL]: Sale error', errorType, data); |
Contributor
There was a problem hiding this comment.
Do we really want to send this to prod?
Contributor
Author
There was a problem hiding this comment.
Yes. We don't show the error message in the UI, but the console logs will at least help developers debug the reason.
| } | ||
| })(); | ||
| }, [environment, environmentId, queryParams]); | ||
| }, [environment, environmentId, queryParams, items]); |
Contributor
There was a problem hiding this comment.
Adding items to the useEffect dependency array will re-fetch the quote whenever items changes. Was that intentional?
Contributor
Author
There was a problem hiding this comment.
Yes. The quote is based on the items, so it should be refetched if those change.
rodrigo-fournier-immutable
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi👋, please ensure the PR title follows the below standards:
type(scope): message. For example:feat(passport): my new feature!after thetype(scope), for examplefeat(passport)!: my new breaking featureSummary
Prevent the sale widget from hanging on the "Crunching numbers" screen by clearing loading state reliably, surfacing funding-balance and quote validation errors, and logging errors to the console for debugging.
Identified cases where the flow could hang on "Crunching numbers"
loadingBalancesnever clearedWhen
fetchFundingBalancescompleted (success or failure),loadingBalanceswas only cleared in theonCompletecallback or in thecatchblock. We make sure to clear theloadingBalancesstate even if an error occurred.fetchFundingBalancesthrows (e.g. RPC / smartCheckout failure)If
smartCheckoutor the funding balance fetch threw (e.g. token not on chain, RPC error, etc), the error was not stored in hook state. The UI had no signal to leave the loading view and no path to the error view, so it remained on "Crunching numbers". To fix this, we add an error state, and transition to the error view if the funding balance error becomes filled.Quote returns empty or invalid data
If the order quote API returned empty
currencies, emptyproducts, or products that did not match the requested sale items, the widget never got a validfundingBalancesResult. The flow stayed on the initial/loading state with no transition to Order Review, Top Up, or an error screen. To fix this, we validate the response from the quote API, and if validation fails, we throw an error to ensure we transition to the error view.We additionally add a
console.errorlog on the error view to allow developers to debug these errors.