From 5ea2acd8971c24a9ea720a020a5a36aa8c68b9ce Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Tue, 31 Mar 2026 16:31:09 -0400 Subject: [PATCH] fix(web): array-table Add Item button creates rows with input fields (#302) (#303) 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: Chuck 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 40343fb2..5347fc84 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