From 896063696371ca4ccc36716dbab4d5e03eb4e39a Mon Sep 17 00:00:00 2001 From: Chuck Date: Tue, 31 Mar 2026 14:06:59 -0400 Subject: [PATCH] fix(web): array-table Add Item button creates rows with input fields (#302) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- web_interface/templates/v3/partials/plugin_config.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_interface/templates/v3/partials/plugin_config.html b/web_interface/templates/v3/partials/plugin_config.html index 40343fb22..5347fc84b 100644 --- a/web_interface/templates/v3/partials/plugin_config.html +++ b/web_interface/templates/v3/partials/plugin_config.html @@ -561,8 +561,8 @@ data-full-key="{{ full_key }}" data-max-items="{{ max_items }}" data-plugin-id="{{ plugin_id }}" - data-item-properties="{{ item_properties|tojson|e }}" - data-display-columns="{{ display_columns|tojson|e }}" + data-item-properties='{% set ns = namespace(d={}) %}{% for k in display_columns %}{% if k in item_properties %}{% set _ = ns.d.update({k: item_properties[k]}) %}{% endif %}{% endfor %}{{ ns.d|tojson }}' + data-display-columns='{{ display_columns|tojson }}' class="mt-3 px-4 py-2 text-sm bg-blue-600 hover:bg-blue-700 text-white rounded-md" {% if array_value|length >= max_items %}disabled style="opacity: 0.5;"{% endif %}> Add Item