fix(vaccinations): show a dose's linked documents and keep them on edit

A dose opened from the list carried no document links, since only the
detail read has them. The edit sheet showed an empty picker, and saving
any change sent that empty set, which the route reads as unlink
everything. The sheet now reads the dose's own links before it shows
them, and a save leaves the links alone unless they were changed.

A link to one dose or visit (/vaccinations?dose=, /checkups?visit=) now
scrolls to it and opens it for someone who may edit it.
This commit is contained in:
Marc-André Bombeck committed 2026-09-25 07:10:56 +02:00
1 parent 31f0d7c9fb
commit 6e05f86e7b
10 files changed
+233 -12

No files matched your search

+5 -1
View File
@@ -2,6 +2,7 @@
import { useCallback, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { useSearchParams } from "next/navigation";
import { useAuth } from "@/hooks/use-auth";
import { useMounted } from "@/hooks/use-mounted";
@@ -38,7 +39,10 @@ export default function CheckupsPageClient() {
const mounted = useMounted();
const queryClient = useQueryClient();
const { t } = useTranslations();
const [view, setView] = useState("vorsorge");
// A link to one visit (`?visit=<id>`, from a document's link chip) lands on
// the visits tab, where the section opens it.
const linkedVisit = useSearchParams()?.get("visit");
const [view, setView] = useState(linkedVisit ? "visits" : "vorsorge");
const refresh = useCallback(
() =>
+8 -2
View File
@@ -1,6 +1,6 @@
"use client";
import { useEffect } from "react";
import { Suspense, useEffect } from "react";
import { useRouter } from "next/navigation";
import { useAuth } from "@/hooks/use-auth";
@@ -42,5 +42,11 @@ export default function VaccinationsPage() {
return <PageAuthGate />;
}
return <VaccinationsView />;
// The view reads `?dose=` through `useSearchParams`, which needs a
// boundary on a statically rendered page.
return (
<Suspense fallback={<PageAuthGate />}>
<VaccinationsView />
</Suspense>
);
}