fix: dashboard flickering on poll, animation replay, and scroll
- Add placeholderData to useRouteMetrics and usePunchcard hooks so data stays stable between refetches instead of going undefined → flicker - Disable Recharts animation on Treemap (isAnimationActive=false) - Make .content scrollable (overflow-y: auto, flex: 1, min-height: 0) so charts below the fold are accessible Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,7 @@ export function useRouteMetrics(from?: string, to?: string, appId?: string) {
|
|||||||
if (!res.ok) throw new Error('Failed to load route metrics');
|
if (!res.ok) throw new Error('Failed to load route metrics');
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
|
placeholderData: (prev: unknown) => prev,
|
||||||
refetchInterval,
|
refetchInterval,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ export function usePunchcard(application?: string) {
|
|||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['dashboard', 'punchcard', application],
|
queryKey: ['dashboard', 'punchcard', application],
|
||||||
queryFn: () => fetchJson<PunchcardCell[]>('/search/stats/punchcard', { application }),
|
queryFn: () => fetchJson<PunchcardCell[]>('/search/stats/punchcard', { application }),
|
||||||
placeholderData: (prev: PunchcardCell[] | undefined) => prev,
|
placeholderData: (prev: PunchcardCell[] | undefined) => prev ?? [],
|
||||||
refetchInterval,
|
refetchInterval,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.refreshIndicator {
|
.refreshIndicator {
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ export function Treemap({ items, onItemClick }: TreemapProps) {
|
|||||||
nameKey="name"
|
nameKey="name"
|
||||||
stroke="none"
|
stroke="none"
|
||||||
content={renderContent}
|
content={renderContent}
|
||||||
|
isAnimationActive={false}
|
||||||
>
|
>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
contentStyle={rechartsTheme.tooltip.contentStyle}
|
contentStyle={rechartsTheme.tooltip.contentStyle}
|
||||||
|
|||||||
Reference in New Issue
Block a user