diff --git a/web/src/components/gardens/LeaveGardenModal.tsx b/web/src/components/gardens/LeaveGardenModal.tsx index 2b82e26..5ccb540 100644 --- a/web/src/components/gardens/LeaveGardenModal.tsx +++ b/web/src/components/gardens/LeaveGardenModal.tsx @@ -16,7 +16,11 @@ export function LeaveGardenModal({ garden, onClose }: { garden: Garden; onClose: confirmDisabled={!me.data} errorFallback="Could not leave the garden." onConfirm={async () => { - if (me.data) await remove.mutateAsync(me.data.id) + // The button is disabled without a current user; throw rather than + // silently resolve (which would close the dialog as if it had worked) if + // that guard ever drifts. + if (!me.data) throw new Error('Not signed in.') + await remove.mutateAsync(me.data.id) }} onClose={onClose} > diff --git a/web/src/lib/objects.ts b/web/src/lib/objects.ts index 9c0a4e0..4694dfc 100644 --- a/web/src/lib/objects.ts +++ b/web/src/lib/objects.ts @@ -381,7 +381,9 @@ export function useClearObject(gardenId: number) { return res.cleared }, onSettled: () => qc.invalidateQueries({ queryKey: fullKey(gardenId) }), - onError: (err) => toast.error(objectErrorMessage(err, 'Could not clear the bed.')), + // No toast: the only caller (ClearBedModal → ConfirmModal) shows the failure + // inline in the dialog, which is more contextual than a detached toast — and + // two of them for one failure is worse than one. }) }