Skip to content

Commit 020d484

Browse files
committed
fix: prevent chart stack unmount during transient empty-data states
visibleRows briefly becomes empty during startTransition filter updates, unmounting the chart DOM and collapsing body height from ~2100px to 680px. Browser clamps scrollY to 0 since content no longer tall enough. Keep chart stack mounted with display:none instead of conditional rendering so the DOM height is preserved and scroll position survives.
1 parent 9c68656 commit 020d484

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/components/ReportPageLayout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,14 +578,17 @@ export function ReportPageLayout({ schema, allowedReportTypes, metricOptions }:
578578
</div>
579579
)}
580580

581-
{activeTab === 'charts' && visibleRows.length > 0 && (() => {
581+
{activeTab === 'charts' && (() => {
582+
const hasData = visibleRows.length > 0;
582583
const isFlatReport = activeReport?.type === REPORT_TYPES.GHAS_ACTIVE_COMMITTERS
583584
|| activeReport?.type === REPORT_TYPES.DORMANT_USERS
584585
|| activeReport?.type === REPORT_TYPES.COPILOT_SEAT_ACTIVITY
585586
|| activeReport?.type === REPORT_TYPES.ENTERPRISE_MEMBERS;
586587
return (
587588
<Suspense fallback={null}>
588-
<div className={styles.chartStack} key={activeReportIndex}>
589+
{/* Keep chart DOM alive during transient empty states (e.g. startTransition
590+
filter updates) to prevent body-height collapse → scroll-position loss. */}
591+
<div className={styles.chartStack} key={activeReportIndex} style={hasData ? undefined : { display: 'none' }}>
589592
{!isFlatReport && (
590593
<div className={styles.chartSurface}>
591594
<TimeSeriesChart metricOptions={chartMetricOptions} />

0 commit comments

Comments
 (0)