fix(compare): keep chart data when a client refetch fails
The compare view refetches /api/compare on the client after SSR; on any failure the catch nulled comparisonData, destroying the working SSR-provided chart. A transient error (or staging's broken external /api proxy) should not blank a comparison the user is already viewing — keep the existing data instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,8 +111,10 @@ export function ComparisonView({
|
||||
setComparisonData(data.comparison);
|
||||
})
|
||||
.catch((err) => {
|
||||
// Keep whatever we already have (SSR data or a previous fetch) rather
|
||||
// than blanking the chart — a transient refetch failure shouldn't
|
||||
// destroy a working comparison the user is looking at.
|
||||
console.error('Failed to fetch comparison:', err);
|
||||
setComparisonData(null);
|
||||
});
|
||||
} else {
|
||||
setComparisonData(null);
|
||||
|
||||
Reference in New Issue
Block a user