Merge the Apple Health import end-to-end journey

This commit is contained in:
Marc-André Bombeck committed 2026-09-10 01:09:27 +02:00
commit 1dc4f70fed
6 files changed
+421 -4

No files matched your search

@@ -343,6 +343,29 @@ export function MeasurementList({
},
[unitDisplay, glucoseUnit],
);
/**
* Machine-readable mirror of what the row renders — the same number and
* the same unit, before `Intl` turns them into locale text.
*
* The rendered cell is the only place a reading's value and unit appear
* together, and it appears there as "8.421 steps" or "8,421 steps"
* depending on who is looking. A browser test that has to assert a stored
* unit therefore either pins a locale or matches a loose number, and both
* describe the formatter rather than the reading. These attributes carry
* the reading itself, and the desktop table and the mobile list emit the
* same set, so an assertion holds at either viewport.
*/
const rowIdentityAttrs = useCallback(
(m: Measurement, isGrouped: boolean) => ({
"data-testid": "measurement-row",
"data-measurement-type": m.type,
"data-measurement-value": String(
isGrouped ? m.value : rowDisplay(m).value,
),
"data-measurement-unit": isGrouped ? m.unit : rowDisplay(m).unit,
}),
[rowDisplay],
);
// v1.28.42 (H3) — the desktop table and the mobile card list used to BOTH
// render (only CSS `display` hid one), so a dense cumulative (up to ~5000
// rows) or sleep page built every row subtree twice — double the DOM, double
@@ -1168,8 +1191,7 @@ export function MeasurementList({
// without matching translated text that also
// renders at a different size on the card list
// below.
data-testid="measurement-row"
data-measurement-type={m.type}
{...rowIdentityAttrs(m, isGrouped)}
data-display-unit={
isGrouped ? m.unit : rowDisplay(m).unit
}
@@ -1374,8 +1396,7 @@ export function MeasurementList({
key={m.id}
data-state={isSelected ? "selected" : undefined}
// Same addressing contract as the desktop row above.
data-testid="measurement-row"
data-measurement-type={m.type}
{...rowIdentityAttrs(m, isGrouped)}
data-display-unit={
isGrouped ? m.unit : rowDisplay(m).unit
}
@@ -499,6 +499,7 @@ export function AppleHealthImportCard() {
)}
{(isFailed || uploadError) && (
<p
data-testid="import-apple-health-error"
role="alert"
className="text-destructive flex items-start gap-2 text-sm"
>