feat: admin Ingredients CRUD UI; fix "page not found" after deleting shopping list/recipe/collection (v0.85.0)
Admin > Ingredients lets admins add/edit/delete canonical ingredients and their aliases (e.g. "sel"/"sel fin"/"table salt") without touching code — previously only settable by hand in packages/db/src/seed.ts. Deleting just unlinks referencing pantry items/recipe ingredients (onDelete: set null), nothing else changes. Fixed: deleting a shopping list, recipe, or collection from its own detail page used router.push to navigate away, leaving the deleted resource's URL in browser history — one back-button press landed on a real "Page not found" screen. All three now use router.replace so the dead URL never sits in history. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,9 @@ export function DeleteCollectionDialog({ collectionId }: { collectionId: string
|
||||
const res = await fetch(`/api/v1/collections/${collectionId}?deleteRecipes=${deleteRecipes}`, { method: "DELETE" });
|
||||
if (!res.ok) throw new Error();
|
||||
toast.success(t("deleteSuccess"));
|
||||
router.push("/collections");
|
||||
// replace, not push — the deleted collection's URL should never sit
|
||||
// in history, or the browser back button lands straight on a 404.
|
||||
router.replace("/collections");
|
||||
router.refresh();
|
||||
} catch {
|
||||
toast.error(t("deleteFailed"));
|
||||
|
||||
Reference in New Issue
Block a user