fix(visits): open an upcoming appointment where it lives

Visits are the second tab of `/checkups`, and the bare path opens the
first one, the preventive-care list, which never shows an appointment.
Every surface that listed an upcoming appointment linked it there: the
dashboard's next-appointment line, the Today rail item, the Today
overview fact and the appointment's push notification. A tap on the
appointment landed on the list it is not on.

Each now opens the visit itself (`/checkups?visit=<id>`), or the visits
tab (`/checkups?view=visits`) for a line naming several appointments.
The checkups page reads `view` to pick a tab. The rail item stops
borrowing the check-up item's action: it carries its own label
("View appointment") and intent `visit.view`. The appointment push names
its visit through the producer's `metadata.url` override; a check-up's
push keeps the checkups list.

The same mis-route sat on three links that lead to visits without
being upcoming: a condition's visit rows, the address book's back link
and the onboarding and timeline prompts to add a visit.

`visit-link-guard.test.ts` keeps the visit paths in the builder and
counts every bare `/checkups` per file, each with the reason it names
the checkups list.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 12:22:36 +02:00
1 parent 78bacb0d86
commit 0dcafeeb70
29 files changed
+591 -23

No files matched your search

@@ -225,9 +225,11 @@ describe("the visit row (v1.39 C2)", () => {
inputs({ onboarding: onboardingState({}, { visit: "within-a-month" }) }),
);
expect(asked.map((i) => i.id)).toContain("visit");
// The visits tab: the bare page opens on the checkups, where a visit is
// neither listed nor added.
expect(asked.find((i) => i.id === "visit")).toMatchObject({
done: false,
href: "/checkups",
href: "/checkups?view=visits",
});
const later = buildChecklist(
inputs({ onboarding: onboardingState({}, { visit: "later" }) }),
+4 -1
View File
@@ -6,6 +6,8 @@
* status + dismissed-ids set) and renders against the result.
*/
import { VISITS_PATH } from "@/lib/encounters/visit-links";
import {
hasEnteredOnboardingFlow,
isOnboardingSettled,
@@ -227,7 +229,8 @@ export function buildChecklist(inputs: ChecklistInputs): ChecklistItem[] {
items.push({
id: "visit",
done: inputs.upcomingVisitCount >= 1,
href: "/checkups",
// The visits tab, where a visit is added; the bare page opens checkups.
href: VISITS_PATH,
dismissed: inputs.dismissedIds.has("visit"),
});
}