Skip to content

Commit cc231f9

Browse files
dougborgclaude
andcommitted
docs(claude): document Prefab DataTable mustache state-binding requirement
Adds a Known Pitfalls entry explaining why bare-string state references (``rows="items"``) crash the JS renderer with ``t.some is not a function`` and how to use mustache form (``rows="{{ items }}"``) instead. Links to the unit-test enforcement (``_assert_state_bindings_resolve``) and the browser-render harness as the proof-it-works contracts. Discovered during PR #634 investigation; was the root cause of #629 (blank iframe on ``modify_manufacturing_order`` 12-action plans). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 26cbd47 commit cc231f9

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,22 @@ Common mistakes to avoid:
280280
PAT-based pushes); tightening that bypass is tracked in #429 (GitHub App migration).
281281
Until #429 lands, the local hook is the only mechanical guardrail.
282282

283+
- **Prefab `DataTable.rows` requires mustache `{{ key }}` for state binding, not bare
284+
string** - The Python pydantic field type accepts `rows: str` either way, but the JS
285+
renderer crashes the entire iframe with `t.some is not a function` if it sees a bare
286+
state-key string — it treats the string as the rows array itself, calls `.some()` on a
287+
string, and the React tree never mounts. Use mustache form everywhere:
288+
`rows="{{ items }}"`, `rows="{{ stock.by_location }}"` (dotted paths supported).
289+
`_assert_state_bindings_resolve` in `katana_mcp_server/tests/test_prefab_ui.py`
290+
enforces this on every state-bound DataTable. The browser-render harness in
291+
`katana_mcp_server/tests/browser/` proves cards actually render in headless Chromium —
292+
the prior unit-test contract (`to_json()` returns a dict with `$prefab`) was
293+
insufficient because the wire envelope can be "valid but unrenderable." Discovered
294+
while investigating #629; bit every state-bound DataTable in the repo (search,
295+
inventory, verification, batch_recipe, modification card). Run
296+
`uv run poe test-browser` to exercise the JS renderer locally; needs one-time
297+
`uv run playwright install chromium`.
298+
283299
## Using the LSP tool
284300

285301
Both Python (pyright) and TypeScript (typescript-language-server) LSPs are configured

0 commit comments

Comments
 (0)