Cleanup: ConfirmModal primitive, drop dead PageStub, full-width editor (#107) #116

Merged
steve merged 2 commits from feat/cleanup into main 2026-07-22 14:05:20 +00:00
2 changed files with 8 additions and 2 deletions
Showing only changes of commit 440e43eb78 - Show all commits
@@ -16,7 +16,11 @@ export function LeaveGardenModal({ garden, onClose }: { garden: Garden; onClose:
confirmDisabled={!me.data} confirmDisabled={!me.data}
errorFallback="Could not leave the garden." errorFallback="Could not leave the garden."
onConfirm={async () => { onConfirm={async () => {
Review

🟡 Dialog closes on no-op when me.data is absent instead of staying open

error-handling · flagged by 3 models

  • LeaveGardenModal closes on no-op when me.data is absent. web/src/components/gardens/LeaveGardenModal.tsx:18

🪰 Gadfly · advisory

🟡 **Dialog closes on no-op when me.data is absent instead of staying open** _error-handling · flagged by 3 models_ - **`LeaveGardenModal` closes on no-op when `me.data` is absent.** `web/src/components/gardens/LeaveGardenModal.tsx:18` <sub>🪰 Gadfly · advisory</sub>
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} onClose={onClose}
> >
+3 -1
View File
@@ -381,7 +381,9 @@ export function useClearObject(gardenId: number) {
return res.cleared return res.cleared
}, },
onSettled: () => qc.invalidateQueries({ queryKey: fullKey(gardenId) }), 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
Review

🟡 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.tsxuseClearObject 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…

🪰 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.
}) })
} }