Fix dict kwarg evaluation in renderComponentDOM, no-cache static in dev
Dict values (e.g. {:X-CSRFToken csrf}) passed as component kwargs were
not being evaluated through sxEval — symbols stayed unresolved in the DOM.
Also add Cache-Control: no-cache headers for /static/ in dev mode so
browser always fetches fresh JS/CSS without needing hard refresh.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -341,6 +341,14 @@ def create_base_app(
|
|||||||
response.headers["HX-Preserve-Search"] = value
|
response.headers["HX-Preserve-Search"] = value
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
# Prevent browser caching of static files in dev (forces fresh fetch on reload)
|
||||||
|
if app.config["NO_PAGE_CACHE"]:
|
||||||
|
@app.after_request
|
||||||
|
async def _no_cache_static(response):
|
||||||
|
if request.path.startswith("/static/"):
|
||||||
|
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
||||||
|
return response
|
||||||
|
|
||||||
# --- context processor ---
|
# --- context processor ---
|
||||||
if context_fn is not None:
|
if context_fn is not None:
|
||||||
@app.context_processor
|
@app.context_processor
|
||||||
|
|||||||
@@ -1286,8 +1286,8 @@
|
|||||||
kwargs[args[i].name] = sxEval(v, env);
|
kwargs[args[i].name] = sxEval(v, env);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Data arrays, dicts, etc — pass through as-is
|
// Data arrays, dicts, etc — evaluate in caller's env
|
||||||
kwargs[args[i].name] = v;
|
kwargs[args[i].name] = sxEval(v, env);
|
||||||
}
|
}
|
||||||
i += 2;
|
i += 2;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user