Files
loki/widget
daca983bbc fix(widget): don't let report exist when clicking it would do nothing (#356)
The stub is published synchronously by design, so a host can call report()
without knowing whether the widget finished booting. The cost of that: on
a page where the boot gate says inactive — token paused, FleetCrown
unreachable — `typeof window.FleetCrown.report === "function"` is still
true, forever. Nothing ever mounts, so a held report is never replayed.

A host reading that as "the widget is here" renders a Report button that
silently does nothing. Caught on live orangecat.ch, where the stub was
present but the panel had not mounted. That is the exact failure this API
was built to remove, reintroduced one layer up.

So publish readiness alongside the call: `ready` is false until the gate
has said active AND mount() has run. Hosts render a real link to their
feedback page and upgrade it in place only when ready — which also covers
the two cases a readiness check alone cannot, no JavaScript and widget.js
not yet executed. Documented as the recommended shape.

Verified headless: with the gate stubbed inactive the API exists and
`ready` stays false with nothing mounted; with it active `ready` flips
true on mount, and the prefill/diagnostics path still works unchanged.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 17:01:02 +02:00
..