From 1fe4a7af951a57a508db2179663be41e16f289ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 8 Oct 2026 09:52:51 +0200 Subject: [PATCH] fix: settle the new edit and HRV surfaces after a look at them The HRV page's second chart reported its visible window into the same stat-strip slot as the first, so the two replaced each other on every render until React stopped it and the chart failed to load. Only the primary chart reports the window now; the strip describes that measure. The workout edit sheet no longer shows the "leave empty if you just finished" hint, which is about logging and not about a stored start. On the Apple Health card a type's name reads as the row's content above its arrival line, with room between rows. --- ...ealthkit-metric-page-hrv-measures.test.tsx | 25 ++++++++++++++++++- .../insights/healthkit-metric-page.tsx | 4 ++- .../metric-freshness-disclosure.tsx | 13 ++++++++-- .../workouts/manual-workout-form.tsx | 12 ++++++--- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/components/insights/__tests__/healthkit-metric-page-hrv-measures.test.tsx b/src/components/insights/__tests__/healthkit-metric-page-hrv-measures.test.tsx index 3064ffb45..455a59224 100644 --- a/src/components/insights/__tests__/healthkit-metric-page-hrv-measures.test.tsx +++ b/src/components/insights/__tests__/healthkit-metric-page-hrv-measures.test.tsx @@ -22,11 +22,16 @@ vi.mock("@/hooks/use-ai-capability", () => ({ })); vi.mock("next/dynamic", () => ({ default: () => { - const Stub = (props: { types?: string[]; title?: string }) => ( + const Stub = (props: { + types?: string[]; + title?: string; + onVisibleStats?: unknown; + }) => (
); Stub.displayName = "HealthChartStub"; @@ -92,6 +97,24 @@ describe("/insights/hrv — SDNN and RMSSD kept apart (#1110)", () => { expect(found[1]!.title).toMatch(/RMSSD$/); }); + it("lets only the primary chart write the stat strip's window", () => { + // Two charts writing the one stats slot replaced each other's window on + // every render: React's update-depth error, and the chart failed to load. + analyticsMock.mockReturnValue({ + data: { + summaries: { + HEART_RATE_VARIABILITY: { count: 30 }, + HRV_RMSSD: { count: 28 }, + }, + }, + isEmpty: false, + }); + const flags = [...render().matchAll(/data-reports-stats="(yes|no)"/g)].map( + (m) => m[1], + ); + expect(flags).toEqual(["yes", "no"]); + }); + it("keeps one unlabelled SDNN chart when there is no RMSSD", () => { analyticsMock.mockReturnValue({ data: { summaries: { HEART_RATE_VARIABILITY: { count: 30 } } }, diff --git a/src/components/insights/healthkit-metric-page.tsx b/src/components/insights/healthkit-metric-page.tsx index 5acc7c3bb..3863e9062 100644 --- a/src/components/insights/healthkit-metric-page.tsx +++ b/src/components/insights/healthkit-metric-page.tsx @@ -509,7 +509,9 @@ export function HealthKitMetricPage({ userTimezone={user?.timezone} valueScale={resolvedScale} valueOffset={resolvedOffset} - onVisibleStats={onVisibleStats} + // No `onVisibleStats`: the strip describes the primary measure, and + // two charts writing the one stats slot would replace each other's + // window on every render without end. showDataTable /> ) : null} diff --git a/src/components/settings/integrations/metric-freshness-disclosure.tsx b/src/components/settings/integrations/metric-freshness-disclosure.tsx index ae9fba69a..54a23864e 100644 --- a/src/components/settings/integrations/metric-freshness-disclosure.tsx +++ b/src/components/settings/integrations/metric-freshness-disclosure.tsx @@ -129,7 +129,7 @@ export function MetricFreshnessDisclosure< {open && ( -