Skip to content

Add step editor rows to recipe form - #1204

Merged
dgee2 merged 2 commits into
mainfrom
issue-1121-recipe-step-editor
Aug 4, 2026
Merged

Add step editor rows to recipe form#1204
dgee2 merged 2 commits into
mainfrom
issue-1121-recipe-step-editor

Conversation

@dgee2

@dgee2 dgee2 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a reusable StepRowEditor molecule (title, instructions, duration) and wires it into new-recipe-form.vue as a dynamic list, replacing the hardcoded empty steps: [] from #1119/#1120. Reuses the moveItem() reorder helper extracted for the ingredient editor.

  • Add/remove/reorder step rows via the new component.
  • instructionText is required per step.
  • durationMinutes is validated as a positive whole number (not just non-negative) — the backend's RecipeStepItemValidator rejects a duration of 0, so the frontend rule matches that constraint exactly rather than reusing the >=0 rule from the Expand recipe form with metadata fields #1119 top-level time fields, which have no backend-side validation at all.
  • sortOrder is recomputed from array index at submit time.

Test plan

  • pnpm build (type-check + production build)
  • pnpm lint
  • pnpm test:storybook — 22 files / 61 tests passing, including new stories for the step row editor and form-level add/edit/remove/reorder/required-validation/duration-validation coverage

Part of #1100.

Closes #1121.

@dgee2 dgee2 changed the title Add step editor rows to recipe form (#1121) Add step editor rows to recipe form Aug 2, 2026
@dgee2
dgee2 force-pushed the issue-1121-recipe-step-editor branch from 8553c29 to 0321be2 Compare August 3, 2026 08:22
@dgee2
dgee2 force-pushed the issue-1121-recipe-step-editor branch from 0321be2 to e0d7162 Compare August 3, 2026 20:13
@dgee2
dgee2 force-pushed the issue-1121-recipe-step-editor branch from e0d7162 to 2d2edb3 Compare August 4, 2026 07:05
@dgee2
dgee2 force-pushed the issue-1121-recipe-step-editor branch from 2d2edb3 to cd8ca64 Compare August 4, 2026 07:59
@dgee2
dgee2 force-pushed the issue-1121-recipe-step-editor branch from cd8ca64 to 2a32573 Compare August 4, 2026 18:58
Base automatically changed from issue-1120-recipe-ingredient-editor to main August 4, 2026 19:25
Adds a reusable StepRowEditor molecule (title, instructions,
duration) and wires it into new-recipe-form.vue as a dynamic list
with add/remove/reorder controls, reusing the moveItem() helper
extracted for the ingredient editor. instructionText is required per
step; the submit payload now sends the edited step list (with
recomputed sortOrder) instead of a hardcoded empty array.

Duration is validated as a positive whole number (not just
non-negative) to match the backend's RecipeStepItemValidator, which
rejects a duration of 0.

Part of #1100. Closes #1121.
@dgee2
dgee2 force-pushed the issue-1121-recipe-step-editor branch from 2a32573 to 43b0c8b Compare August 4, 2026 19:33
@dgee2
dgee2 marked this pull request as ready for review August 4, 2026 19:35
Copilot AI lite review requested due to automatic review settings August 4, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not ready to approve

The steps list currently uses an index key and the generic reorder helper has a falsy-item bug, both of which can lead to incorrect UI behavior during reordering/removal.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Adds a reusable step-row editor molecule and integrates it into the recipe creation form so users can add/edit/remove/reorder recipe steps, with client-side validation aligned to backend constraints.

Changes:

  • Added StepRowEditor (title, instructions, duration) with required/positive-integer validation and reorder/remove controls.
  • Wired a dynamic steps list into new-recipe-form.vue, reusing a shared moveItem() helper and recomputing sortOrder on submit.
  • Extended Storybook coverage for both the new molecule and the updated form’s steps behavior.
File summaries
File Description
ui/menu-website/src/components/organisms/recipe/new-recipe-form.vue Adds step list state + UI, submission mapping, and shared reorder helper.
ui/menu-website/src/components/organisms/recipe/new-recipe-form.stories.ts Adds stories covering step add/edit/remove/reorder and validation failures.
ui/menu-website/src/components/molecules/recipe/step-row-editor.vue New reusable step editor row component with field validation and controls.
ui/menu-website/src/components/molecules/recipe/step-row-editor.stories.ts Adds Storybook stories validating rendering, v-model updates, and emitted events.
Review details

Suppressed comments (1)

ui/menu-website/src/components/organisms/recipe/new-recipe-form.vue:157

  • 🤖 This comment was written by GitHub Copilot.

The steps editor uses :key="index", which can cause Vue to reuse component instances incorrectly when removing/reordering rows (inputs/validation state can “stick” to the wrong step). Ingredients already use a stable rowId; steps should use the same approach (add a rowId when creating a step, use it as the key, and strip it out when building the UpsertRecipe payload).

    <step-row-editor
      v-for="(step, index) in steps"
      :key="index"
      v-model:instruction-text="step.instructionText"
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread ui/menu-website/src/components/organisms/recipe/new-recipe-form.vue
Adds a rowId to step rows (matching the ingredient editor's pattern
from #1203) so :key isn't the array index, which could cause Vue to
misattribute DOM/validation state to the wrong row across a reorder.
Also adds new-recipe-form unit tests asserting the submitted steps
payload (fields, recomputed sortOrder, and that the internal rowId
never leaks into the request), closing a gap flagged in review where
this behavior was only covered by Storybook.

Co-authored-by: Claude <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
16.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@dgee2
dgee2 merged commit a915c52 into main Aug 4, 2026
12 of 13 checks passed
@dgee2
dgee2 deleted the issue-1121-recipe-step-editor branch August 4, 2026 21:00
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.

Add recipe steps editor to recipe form

2 participants