Cleanup: ConfirmModal primitive, drop dead PageStub, full-width editor (#107) #116
@@ -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}
|
||||
>
|
||||
|
||||
@@ -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
|
||||
|
gitea-actions
commented
🟡 ClearBed failure now surfaces both a toast and ConfirmModal's inline alert error-handling · flagged by 1 model
🪰 Gadfly · advisory 🟡 **ClearBed failure now surfaces both a toast and ConfirmModal's inline alert**
_error-handling · flagged by 1 model_
- **`web/src/lib/objects.ts:384` / `web/src/editor/ClearBedModal.tsx`** — `useClearObject` still has its own `onError: (err) => toast.error(...)`. Since `ClearBedModal` now uses `ConfirmModal`, whose `handleConfirm` also catches the same rejection from `clear.mutateAsync(objectId)` and renders it inline (`ConfirmModal.tsx:52-54`), a clear-bed failure now shows both a toast and the modal's inline alert for the same error. None of the other four converted modals' hooks (`useDeleteGarden`, `useDele…
<sub>🪰 Gadfly · advisory</sub>
|
||||
// inline in the dialog, which is more contextual than a detached toast — and
|
||||
// two of them for one failure is worse than one.
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user
🟡 Dialog closes on no-op when me.data is absent instead of staying open
error-handling · flagged by 3 models
LeaveGardenModalcloses on no-op whenme.datais absent.web/src/components/gardens/LeaveGardenModal.tsx:18🪰 Gadfly · advisory