fix(web): array-table Add Item button creates rows with input fields#303
fix(web): array-table Add Item button creates rows with input fields#303ChuckBuilds merged 1 commit intomainfrom
Conversation
…302) The data-item-properties attribute on the Add Item button was serialized inside double-quoted HTML using {{ item_properties|tojson|e }}. Jinja2's |tojson returns Markup (marked safe), making |e a no-op — the JSON double quotes were not escaped to ". The browser truncated the attribute at the first " in the JSON, so addArrayTableRow() parsed an empty object and created rows with only a trash icon. Fix: switch to single-quote attribute delimiters (JSON only uses double quotes internally) and filter item_properties to only the display columns, avoiding large nested objects in the attribute value. Closes #302 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughModified the serialization of HTMX data attributes in the array-table "Add Item" button, filtering Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@web_interface/templates/v3/partials/plugin_config.html`:
- Around line 564-565: The HTML attribute generation for data-item-properties
uses single-quote delimiters but doesn't escape single quotes inside the JSON
payload, so values in item_properties containing apostrophes will break parsing;
update the template where data-item-properties is produced to run the rendered
JSON through a single-quote escape (e.g., apply |replace("'", "'") to the {{
ns.d|tojson }} output) so that attributes using data-item-properties (and
similarly data-display-columns if needed) remain valid and can be JSON.parsed by
array-table.js.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 51010431-8b0d-46a1-ac23-f7f369339d9e
📒 Files selected for processing (1)
web_interface/templates/v3/partials/plugin_config.html
Summary
data-item-propertiesattribute used{{ item_properties|tojson|e }}inside double-quoted HTML — Jinja2's|tojsonreturnsMarkup(safe), making|ea no-op, so JSON double quotes broke the attributeTest plan
[ArrayTableWidget] Failed to parseerrors — should be noneCloses #302
🤖 Generated with Claude Code
Summary by CodeRabbit