fix(encounters): give the visit form's link pickers their own query keys

The visit form's lab and episode pickers fetched with their own page
sizes under the same keys as the Labs list and the illness pages, which
fetch with others. Whichever read landed first served the other: the
picker could see 50 episodes instead of 100, or the Labs list a 200-row
page as the whole list. The picker reads now have keys of their own,
under the lab and illness roots so writes still evict them.
This commit is contained in:
Marc-André Bombeck committed 2026-09-24 12:17:56 +02:00
1 parent aeb8930ce1
commit a2282a498c
4 files changed
+53 -9

No files matched your search

@@ -87,14 +87,7 @@ export function EncounterLinkPickers({
});
const labs = useQuery({
queryKey: queryKeys.labResultsList({
analyte: undefined,
panel: undefined,
from: undefined,
to: undefined,
page: 0,
sortDir: "desc",
}),
queryKey: queryKeys.labResultsPicker(PICKER_FETCH_LIMIT),
enabled: labsOn,
queryFn: () =>
apiGet<LabListPage>(
@@ -103,7 +96,7 @@ export function EncounterLinkPickers({
});
const episodes = useQuery({
queryKey: queryKeys.illnessEpisodes(true),
queryKey: queryKeys.illnessEpisodesPicker(EPISODE_FETCH_LIMIT),
enabled: illnessOn,
queryFn: () =>
apiGet<IllnessEpisodeDTO[]>(