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);