fix: deduplicate service list in PatchTestsManagement to prevent each_key_duplicate
This commit is contained in:
@@ -53,7 +53,12 @@ import { Button } from '$lib/components/ui/button';
|
|||||||
|
|
||||||
if (ptRes.ok && svcRes.ok) {
|
if (ptRes.ok && svcRes.ok) {
|
||||||
patchTests = await ptRes.json();
|
patchTests = await ptRes.json();
|
||||||
availableServices = await svcRes.json();
|
const svcData = await svcRes.json();
|
||||||
|
const uniqueSvc = new Map();
|
||||||
|
svcData.forEach((s: Service) => {
|
||||||
|
if (s.id) uniqueSvc.set(s.id, s);
|
||||||
|
});
|
||||||
|
availableServices = Array.from(uniqueSvc.values());
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed to load patch test data');
|
toast.error('Failed to load patch test data');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user