Skip to content

feat: archive recipes instead of delete (#72)#86

Open
m-lyon wants to merge 9 commits intomainfrom
72-archive-recipes
Open

feat: archive recipes instead of delete (#72)#86
m-lyon wants to merge 9 commits intomainfrom
72-archive-recipes

Conversation

@m-lyon
Copy link
Copy Markdown
Owner

@m-lyon m-lyon commented Apr 1, 2026

Summary

Replaces hard-delete with soft-archive across the full stack, allowing users to archive and unarchive recipes instead of permanently deleting them.

API Changes

  • Added archived: boolean field (default false) to the Recipe model
  • Added recipeArchiveById and recipeUnarchiveById GraphQL mutations (archive is blocked if recipe is used as ingredient in another recipe)
  • Removed recipeRemoveById mutation from the schema
  • Added migration script (updateSchema_2026-03-30.js) to set archived: false on existing documents

Client Changes

  • Replaced delete mutation/modal with archive mutation/modal (orange color scheme)
  • Added unarchive button on recipe detail view for archived recipes
  • Added "Show Archived" toggle switch in the search bar that switches to archived-only view
  • Search inputs and filters hidden when viewing archived recipes
  • Added archived field to recipe queries and archived: false default filter
  • Added ArchiveIcon and UnarchiveIcon SVG components
  • Updated Zustand search store with showArchived state
  • Fixed stale closure bugs in useSearch hook (showArchivedRef, inline filter computation)

Tests

  • API: 6 new tests — archive, archive-blocked-by-ingredient, unarchive, recipeMany filter, recipeCount filter, recipeRemoveById removed from schema (145/145 passing)
  • Client: Updated archive test suite + new unarchive integration test (340/341 passing, 1 pre-existing failure on main)

Test Plan

  • API tests pass (145/145)
  • Client tests pass (340/341, 1 pre-existing failure)
  • Client lint passes clean
  • All 6 commits reviewed by roborev

m-lyon added 9 commits March 30, 2026 21:23
Replace hard-delete with soft-archive. Add archived boolean field to Recipe
model, archiveById and unarchiveById resolvers, and remove recipeRemoveById
from the public GraphQL schema. Archive uses the same validateItemNotInRecipe
check as delete. Include migration script for existing documents.
- Replace DELETE_RECIPE mutation with ARCHIVE_RECIPE and UNARCHIVE_RECIPE
- Add archived field to GraphQL queries and fragment
- Add archive toggle switch to SearchBar for viewing archived recipes
- Replace ConfirmDeleteModal with ConfirmArchiveModal (orange theme)
- Update ModifyButtons to show archive/unarchive based on recipe state
- Add client-side filter (archived: false) to all recipe list queries
- Update search filter logic to support showArchived toggle
- Add ArchiveIcon and UnarchiveIcon components
- Update all test mocks and rename delete tests to archive tests
Replace the old recipeRemoveById test suite with comprehensive tests for
the new archive/unarchive functionality:
- archiveById sets archived flag and preserves the recipe
- archiveById blocked when recipe is used as ingredient in another recipe
- unarchiveById clears archived flag
- recipeMany respects archived filter (true/false)
- recipeCount respects archived filter
- recipeRemoveById mutation no longer in schema

Remove unused fs, sinon, and Image imports.
Search input, tag filters, and ingredient filters now remain visible when
showArchived is toggled on, allowing users to search/filter within archived
recipes. Toggling showArchived in either direction resets all active filters
to prevent stale search state. Replaced Chakra UI Switch/FormControl with
Mantine Switch and Tooltip for the archive toggle.
Fix line length formatting in API schema and tests. Replace custom
ArchiveIcon/UnarchiveIcon SVGs with GoArchive and RiInboxUnarchiveLine
from react-icons library.
- Use Mantine theme color 'teal' instead of raw hex for Switch
- Add consistent size='18px' to GoArchive icon
- Remove dead ArchiveIcon/UnarchiveIcon custom SVGs and path alias
- Use resetSearch() in setShowArchived to eliminate duplication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant