From 546e105b1058efbaea6f687cada1fe23b274787d Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Tue, 3 Feb 2026 13:37:50 +0000 Subject: [PATCH] fix(templates): prefix Datastar signals with underscore to mark as local Datastar sends all non-underscore signals with every backend request. UI-only signals (showForm, navOpen, isSubmitting, form ref, brew parameters) were being serialized into pagination/search/sort URLs, creating bloated requests. Prefix them with _ so Datastar's default filterSignals excludes them from requests. --- CLAUDE.md | 16 ++++++++-------- templates/bags.html | 16 ++++++++-------- templates/brews.html | 40 ++++++++++++++++++++-------------------- templates/gear.html | 16 ++++++++-------- templates/nav.html | 10 +++++----- templates/roasters.html | 14 +++++++------- templates/roasts.html | 14 +++++++------- 7 files changed, 63 insertions(+), 63 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index fa77fc1..99ee48f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -211,11 +211,11 @@ pub fn render_fragment(template: T, selector: &'static str) -> Resu Templates use Datastar attributes for interactivity: ```html - -
+ +
-
+
@@ -228,17 +228,17 @@ Templates use Datastar attributes for interactivity: -
+
``` Key attributes: -- `data-signals:name="value"` - Reactive state signals -- `data-show="$signal"` - Conditional visibility +- `data-signals:_name="value"` - Local signals (underscore prefix excludes from backend requests) +- `data-show="$_signal"` - Conditional visibility - `data-on:event="expression"` - Event handlers -- `data-ref="name"` - DOM element references +- `data-ref="_name"` - DOM element references (underscore prefix for local refs) - `@get/@post/@put/@delete(url, options)` - HTTP actions with automatic Datastar headers #### URL Generation diff --git a/templates/bags.html b/templates/bags.html index ad78565..4ab8ea6 100644 --- a/templates/bags.html +++ b/templates/bags.html @@ -1,5 +1,5 @@ {% extends "base.html" %} {% block title %}Brewlog · Bags{% endblock %} {% block content %} -
+

Bags

@@ -9,8 +9,8 @@ diff --git a/templates/brews.html b/templates/brews.html index 1977b17..b043c01 100644 --- a/templates/brews.html +++ b/templates/brews.html @@ -1,5 +1,5 @@ {% extends "base.html" %} {% block title %}Brewlog · Brews{% endblock %} {% block content %} -
+

Brews

@@ -9,8 +9,8 @@ - - + + +
@@ -112,9 +112,9 @@
Grind Setting *
- - - + + +
@@ -122,9 +122,9 @@
Water (ml) *
- - - + + +
@@ -132,9 +132,9 @@
Temp (C) *
- - - + + +
@@ -143,7 +143,7 @@ diff --git a/templates/gear.html b/templates/gear.html index 66bf96a..44f6ea5 100644 --- a/templates/gear.html +++ b/templates/gear.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block title %}Brewlog · Gear{% endblock %} {% block content %} -
+

Gear

@@ -11,8 +11,8 @@ diff --git a/templates/nav.html b/templates/nav.html index 12da103..0e258d1 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -1,4 +1,4 @@ -
-