oficina / fichas Public

Answer the review (Claude Fable 5.1); estilo 846b397

- estilo's busy.js now holds only a submit with a spinner showing
  (rastrillo discussion 51), so script submits no longer stall.
- Scripts that submit on the visitor's behalf pass the form's button, so
  it shows the spinner (Calendar quick-add, Sheets file drop).
- Slides' presenter Next/Previous/Blackout opt out (data-busy="false"):
  a live talk wants those instant. Memoria's old vendoring tool no longer
  writes rastrillo.js, which would bring the old busy rule back.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev c2181873062ce81d49595aae9eb4d27027f07fec parent 5465d24
3 files changed, +10 −3
  • go.mod +1 −1
  • go.sum +2 −0
  • internal/fichas/static/busy.js +7 −2

CI passed — run details

CI log
=== vet ===
go vet ./...
=== fmt ===
=== test ===
go test ./...
?   	amadan.net/oficina/fichas/cmd/fichas	[no test files]
ok  	amadan.net/oficina/fichas/internal/fichas	0.161s
?   	amadan.net/oficina/fichas/internal/fichas/icons	[no test files]
ok  	amadan.net/oficina/fichas/internal/fichas/seal	(cached)
ok  	amadan.net/oficina/fichas/internal/fichastest	0.114s
?   	amadan.net/oficina/fichas/scripts/writeestilo	[no test files]
=== migration-check ===
go run github.com/carlosframework/rastrillo/cmd/rastrillo migration check
rastrillo migration check: models and migrations agree
diff --git a/go.mod b/go.mod
index 886170a..fade1b9 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.26
toolchain go1.26.5
require (
- amadan.net/oficina/estilo.git v0.0.0-20260929095838-0994675f496e
+ amadan.net/oficina/estilo.git v0.0.0-20260929165053-846b39772f3c
github.com/carlosframework/rastrillo v0.23.0
github.com/chromedp/chromedp v0.14.2
github.com/go-chi/chi/v5 v5.3.2
diff --git a/go.sum b/go.sum
index c098712..ba71246 100644
--- a/go.sum
+++ b/go.sum
@@ -4,6 +4,8 @@ amadan.net/oficina/estilo.git v0.0.0-20260929095046-d0664ee49914 h1:V0AyxXYCxqGZ
amadan.net/oficina/estilo.git v0.0.0-20260929095046-d0664ee49914/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
amadan.net/oficina/estilo.git v0.0.0-20260929095838-0994675f496e h1:LTSmIWUS8RjPb6m94Ynf7moyFYeBXr08rdOr3nmNqvg=
amadan.net/oficina/estilo.git v0.0.0-20260929095838-0994675f496e/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
+amadan.net/oficina/estilo.git v0.0.0-20260929165053-846b39772f3c h1:YYocIz3r3b4oIA0K/58JkSsmyTOCzMT/2GaW/MFbbPo=
+amadan.net/oficina/estilo.git v0.0.0-20260929165053-846b39772f3c/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/carlosframework/rastrillo v0.23.0 h1:tKAAlwPt4Pg/rkqk7o6jvV12bbZ0r34oEVpuOlKfX7w=
diff --git a/internal/fichas/static/busy.js b/internal/fichas/static/busy.js
index 5d0a9f8..550a843 100644
--- a/internal/fichas/static/busy.js
+++ b/internal/fichas/static/busy.js
@@ -166,7 +166,7 @@
// back); so does the guard's own refusal of a second submit. Only a
// submit nobody else stopped is held, and only if the busy rule armed
// it (aria-busy on the form: not opted out, not a dialog, not a new
- // window).
+ // window) and a button is showing the spinner.
var held = new WeakSet(); // submit events this listener cancelled
var pending = new Map(); // form -> timer, for a hold still running
var releasing = null; // the form whose held submit is going now
@@ -175,9 +175,14 @@
if (!form || form.tagName !== "FORM") return;
if (form === releasing) { releasing = null; return; }
if (e.defaultPrevented || form.getAttribute("aria-busy") !== "true") return;
+ // Only a submit with a spinner to show is held: the hold is for the
+ // spinner. A script's requestSubmit() with no submitter, or a button
+ // that opted out, has nothing on screen to keep up, and holding it
+ // would only be a silent 650ms stall. The form is still guarded.
+ var btn = e.submitter || null;
+ if (!btn || btn.getAttribute("aria-busy") !== "true") return;
e.preventDefault();
held.add(e);
- var btn = e.submitter || null;
pending.set(form, setTimeout(function () { release(form, btn); }, HOLD_MS));
});