Skip to content

Key cooking-mode used marks by rendered row, not ingredient name - #547

Merged
sysread merged 1 commit into
mainfrom
claude/cooking-ingredient-checkbox-bug-24dh0x
Sep 11, 2026
Merged

sysread merged 1 commit into
mainfrom
claude/cooking-ingredient-checkbox-bug-24dh0x

Conversation

@sysread

@sysread sysread commented Sep 11, 2026

Copy link
Copy Markdown
Owner

SYNOPSIS: in cooking mode, checking an ingredient that appears in two sections ticked both rows. Used marks now key on the rendered row, not the name.

PURPOSE: every ingredient checkbox is identified by name. That is right in grocery mode (same-name rows mirror one product) but cooking mode reused it for "used" marks, so black pepper in the spice-mix section and black pepper in the soup shared one mark.

DESCRIPTION:

  • currently: renderer stamps data-ing only; the used list stores normalized names; the sync effect and toggle handler key both modes on that name; the "N of M used" counter totals the flat parse ingredient list
  • this PR: renderer also stamps data-row (ordinal across all checkbox rows, numbered straight through section sub-lists); cooking mode stores <row>:<normalized name> via usedIngredientKey; sync effect + toggle handler key cooking mode on that; grocery mode unchanged (still name-keyed); counter totals ingredientRowsForRecipe, built from the same bucket list the HTML render walks
  • result: same-name rows in different sections mark used independently, and the counter matches the visible row count

Notes:

  • the name rides along in the key on purpose: a mid-session edit that shifts rows drops stale marks rather than moving them onto a different ingredient
  • the flat parse dedupes across sections, so recipe.ingredients.length undercounted sectioned recipes (cozy soup: 3 vs 4 rows); switching the total is intentional
  • open cooking sessions at deploy time show old marks as unchecked (stored key shape changed); sessions expire within 6h anyway

🤖 Generated with Claude Code

https://claude.ai/code/session_01WSi7AYhiwS76wXVLVoZLG3


Generated by Claude Code

In cooking mode, checking off an ingredient that appears in more
than one section (black pepper in a spice-mix section and again in
the soup) ticked every row sharing that name. The used list stored
normalized ingredient names, which is the right identity for grocery
mode (one product, bought once) but wrong for cooking, where each
row is its own thing to use.

The renderer now stamps each checkbox with data-row, its ordinal
across every ingredient row in the render, numbered straight through
section sub-lists. Cooking mode stores "<row>:<normalized name>" in
the session's used list; the name rides along so a mid-session edit
that shifts rows drops stale marks instead of moving them onto a
different ingredient. Grocery mode still keys by name only.

The "N of M used" counter now totals the rows actually rendered,
built from the same bucket list the HTML render walks. The flat
parse's ingredient count dedupes across sections and undercounted
sectioned recipes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WSi7AYhiwS76wXVLVoZLG3
@sysread
sysread merged commit 10cb103 into main Sep 11, 2026
1 check passed
@sysread
sysread deleted the claude/cooking-ingredient-checkbox-bug-24dh0x branch September 11, 2026 14:03
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.

2 participants