From 90e99383c3e25fd56ed97f84116d0df2b9120b90 Mon Sep 17 00:00:00 2001 From: David Ejere Date: Tue, 28 Jul 2026 14:02:38 +0100 Subject: [PATCH 1/3] fix(creator-card): wrap bonding curve chart in error boundary (#690) Extends SectionErrorBoundary with optional title/description props (backward compatible, defaulting to prior copy) so the bonding curve sparkline in CreatorCard can fail independently without taking down the whole card or profile page. Retry is manual only (no auto-retry loop). --- src/components/common/CreatorCard.tsx | 52 +++++++----- .../common/SectionErrorBoundary.tsx | 27 ++++-- .../__tests__/SectionErrorBoundary.test.tsx | 82 +++++++++++++++++++ 3 files changed, 132 insertions(+), 29 deletions(-) diff --git a/src/components/common/CreatorCard.tsx b/src/components/common/CreatorCard.tsx index 43c82eb7..65781d52 100644 --- a/src/components/common/CreatorCard.tsx +++ b/src/components/common/CreatorCard.tsx @@ -12,6 +12,7 @@ import { ExternalLink, } from 'lucide-react'; import { Sparkline } from '@/components/ui/sparkline'; +import SectionErrorBoundary from '@/components/common/SectionErrorBoundary'; import { DropdownMenu, DropdownMenuContent, @@ -367,29 +368,36 @@ const CreatorCard: React.FC = ({ else if (latest < earliest) lineColor = '#ef4444'; return ( -
- - - - - - - - - - - {priceChartAccessibility.points.map(point => ( - - - + +
+ +
{priceChartAccessibility.summary}
PointKey price
{point.label}{point.value}
+ + + + + - ))} - -
{priceChartAccessibility.summary}
PointKey price
-
+ + + {priceChartAccessibility.points.map(point => ( + + {point.label} + {point.value} + + ))} + + + + ); })()} diff --git a/src/components/common/SectionErrorBoundary.tsx b/src/components/common/SectionErrorBoundary.tsx index 97494039..8e195b67 100644 --- a/src/components/common/SectionErrorBoundary.tsx +++ b/src/components/common/SectionErrorBoundary.tsx @@ -8,6 +8,17 @@ interface Props { sectionName?: string; minHeight?: string | number; className?: string; + /** + * Overrides the default "Something went wrong in this section" heading. + * Use for a short, section-specific message (e.g. "Chart unavailable — + * try refreshing"). + */ + title?: string; + /** + * Overrides the default explanatory paragraph. Pass an empty string to + * show only the title (no secondary copy). + */ + description?: string; } interface State { @@ -48,14 +59,16 @@ class SectionErrorBoundary extends Component {

- Something went wrong in this section + {this.props.title ?? 'Something went wrong in this section'}

-

- {this.props.sectionName - ? `We encountered an error while loading the ${this.props.sectionName}.` - : 'We encountered an error while loading this content.'} - Please try again or contact support if the issue persists. -

+ {this.props.description !== '' && ( +

+ {this.props.description ?? + (this.props.sectionName + ? `We encountered an error while loading the ${this.props.sectionName}. Please try again or contact support if the issue persists.` + : 'We encountered an error while loading this content. Please try again or contact support if the issue persists.')} +

+ )}