fix: Alpine.js x-data broken by inner double quotes + API list response crash

- Extract JSON data to <script> tags instead of tojson_attr in x-data attributes
- Remove literal " from CSS selector in x-data (meta[name=csrf-token])
- Move Alpine.js defer script after extra_js block in base.html
- Add isinstance(resp, dict) guard before .get("error") in measure.py and maker.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Adriano
2026-02-07 20:13:22 +01:00
parent 004f794c75
commit 2453e552fb
5 changed files with 16 additions and 14 deletions
+4 -4
View File
@@ -27,15 +27,15 @@ def recipe_list():
resp = api_client.get("/api/recipes", params=params)
if resp.get("error"):
if isinstance(resp, dict) and resp.get("error"):
flash(_("Errore nel caricamento delle ricette: %(error)s", error=resp.get("detail", "")), "error")
recipes = []
total = 0
pages = 0
else:
recipes = resp.get("items", [])
total = resp.get("total", 0)
pages = resp.get("pages", 1)
recipes = resp.get("items", []) if isinstance(resp, dict) else resp
total = resp.get("total", 0) if isinstance(resp, dict) else len(recipes)
pages = resp.get("pages", 1) if isinstance(resp, dict) else 1
return render_template(
"maker/recipe_list.html",