Key cooking-mode used marks by rendered row, not ingredient name - #547
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
data-ingonly; 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 listdata-row(ordinal across all checkbox rows, numbered straight through section sub-lists); cooking mode stores<row>:<normalized name>viausedIngredientKey; sync effect + toggle handler key cooking mode on that; grocery mode unchanged (still name-keyed); counter totalsingredientRowsForRecipe, built from the same bucket list the HTML render walksNotes:
recipe.ingredients.lengthundercounted sectioned recipes (cozy soup: 3 vs 4 rows); switching the total is intentional🤖 Generated with Claude Code
https://claude.ai/code/session_01WSi7AYhiwS76wXVLVoZLG3
Generated by Claude Code