fix(shared): tag filter SQL precedence, balance cards filter by tag

This commit is contained in:
2026-03-14 21:30:33 +11:00
parent 02ac136e19
commit d53d3106f2
4 changed files with 27 additions and 14 deletions
+4 -3
View File
@@ -198,11 +198,12 @@ export function useParticipants() {
});
}
export function useParticipantBalances() {
export function useParticipantBalances(tagIds?: string[]) {
return useQuery<{ id: number; name: string; total_owed: number; unsettled_count: number }[]>({
queryKey: ["participant-balances"],
queryKey: ["participant-balances", tagIds],
queryFn: async () => {
const res = await fetch("/api/participants/balances");
const params = tagIds?.length ? `?tag_ids=${tagIds.join(",")}` : "";
const res = await fetch(`/api/participants/balances${params}`);
return res.json();
},
});