Skip to content

Commit ecf5505

Browse files
committed
fix(billing): distinguish a failed summary fetch from zero usage
The compact Billing glance only branched on isPending, so once useUsageSummary settled into an error state, totalCredits stayed undefined and formatCreditsLabel(0) rendered "0 credits" — visually identical to genuinely having no usage this period. Now shows the same neutral "—" placeholder for isError as it already does for isPending.
1 parent 447c404 commit ecf5505

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/settings/components/billing/components/credit-usage-section

apps/sim/app/workspace/[workspaceId]/settings/components/billing/components/credit-usage-section/credit-usage-section.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ interface CreditUsageSectionProps {
1818
* except Enterprise, which manages billing out-of-band.
1919
*/
2020
export function CreditUsageSection({ workspaceId }: CreditUsageSectionProps) {
21-
const { data: totalCredits, isPending } = useUsageSummary(SUMMARY_PERIOD)
21+
const { data: totalCredits, isPending, isError } = useUsageSummary(SUMMARY_PERIOD)
2222

2323
return (
2424
<SettingsSection label='Credit usage'>
2525
<div className='flex items-center justify-between px-2'>
2626
<div className='flex flex-col justify-center gap-[1px]'>
2727
<span className='text-[14px] text-[var(--text-body)] tabular-nums'>
28-
{isPending ? '—' : formatCreditsLabel(totalCredits ?? 0)}
28+
{isPending || isError ? '—' : formatCreditsLabel(totalCredits ?? 0)}
2929
</span>
3030
<span className='text-[12px] text-[var(--text-muted)]'>Last 30 days</span>
3131
</div>

0 commit comments

Comments
 (0)