From 5004b83ceea4aede258856840d6641fcda848dc6 Mon Sep 17 00:00:00 2001 From: Thor Galle Date: Tue, 3 Sep 2024 14:47:19 +0300 Subject: [PATCH] fix: fix local garden store update when index === 0 --- src/lib/stores/garden.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/stores/garden.ts b/src/lib/stores/garden.ts index 856c3c18..cda10611 100644 --- a/src/lib/stores/garden.ts +++ b/src/lib/stores/garden.ts @@ -22,7 +22,7 @@ export const addToAllGardens = async (garden: Garden) => { // Update the the specific garden in the local store of gardens allGardens.update((gardens) => { const index = gardens.findIndex((g) => g.id === garden.id); - if (index) { + if (typeof index === 'number') { gardens[index] = garden; } else { gardens.push(garden);