diff --git a/.claude/skills/ssr-form-migration/reference/gotchas.md b/.claude/skills/ssr-form-migration/reference/gotchas.md index 8881fbf6..8e62f904 100644 --- a/.claude/skills/ssr-form-migration/reference/gotchas.md +++ b/.claude/skills/ssr-form-migration/reference/gotchas.md @@ -265,6 +265,24 @@ carve-out. Verify with `load-file` (compile) + `lein cljfmt check`, not by eyeba diff is contained with `git diff -U0 | grep '^@@'` — the hunks should cluster only where you edited (requires + the modal region), nothing else. +## Wiring a modal onto the wizard2 engine — three traps that cost a debug cycle each + +1. **Strip the engine's nav fields in the step `:decode`.** The posted form carries + `wizard-id` / `current-step` / `direction` alongside the real fields. If the step schema is + an open `:map` (most are), `mc/decode` keeps them, they ride into `get-all`, and the save's + `:upsert-entity` dies with `:db.error/not-an-entity ... :current-step`. Fix: `select-keys` + the decode to the schema's known top-level keys (the same allowlist trick as the flat-form + migrations). Symptom is a **500 on save**, not a validation message. +2. **New repeated-row needs a temp `:db/id` or the step can't advance.** If the row schema + requires `[:db/id [:or entity-id temp-id]]`, an added row with no id fails per-step + validation, so the engine re-renders the *same* step instead of advancing — looks like "the + Next/Test button does nothing." Give new rows `(str (java.util.UUID/randomUUID))`. +3. **Nav is a `direction` field, and Back/Save are both submit buttons.** The footer buttons + are plain `