fix(events): keep event-detail ticket counts live after a purchase #119

Merged
padreug merged 1 commit from feat/event-detail-live-ticket-count into dev 2026-06-18 12:44:10 +00:00
Owner

From the 17 Jun design review — "tickets remaining/total doesn't update dynamically once I purchase."

It is a Nostr event: tickets_available/tickets_sold are tags on the NIP-52 calendar event, which is replaceable, and the events extension republishes it when a ticket sells (services.py — on invoice paid). The webapp already has a reactive event bound to the store and a dTag-scoped subscription.

The gap: useEventDetail.load() early-returned when the event was already cached (arriving from the feed), so the detail page set up no live subscription — the republished event never arrived and counts stayed stale until a manual reload.

Fix: always open the dTag-scoped subscription (only the one-shot query + loading state are skipped on a cache hit); unsubscribe any prior sub before re-subscribing so reload() can't leak one. The reactive event then reflects the republished counts live.

🤖 Generated with Claude Code

From the 17 Jun design review — "tickets remaining/total doesn't update dynamically once I purchase." It *is* a Nostr event: `tickets_available`/`tickets_sold` are tags on the NIP-52 calendar event, which is replaceable, and the events extension **republishes it when a ticket sells** (`services.py` — on invoice paid). The webapp already has a reactive `event` bound to the store and a dTag-scoped subscription. **The gap:** `useEventDetail.load()` early-returned when the event was already cached (arriving from the feed), so the detail page set up **no live subscription** — the republished event never arrived and counts stayed stale until a manual reload. **Fix:** always open the dTag-scoped subscription (only the one-shot query + loading state are skipped on a cache hit); unsubscribe any prior sub before re-subscribing so `reload()` can't leak one. The reactive `event` then reflects the republished counts live. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
useEventDetail.load() early-returned when the event was already in the
store, so arriving from the feed (cached) set up no live subscription.
NIP-52 calendar events are replaceable and the events extension
republishes them when a ticket sells (updating tickets_sold/available),
but with no subscription the detail page never received the update —
counts went stale until a manual reload.

Always open the dTag-scoped subscription (only the one-shot query +
loading state are skipped on a cache hit), and unsubscribe a prior sub
before re-subscribing so reload() can't leak one. The reactive `event`
computed then reflects republished counts without a reload.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
padreug force-pushed feat/event-detail-live-ticket-count from dce55f0c0c to 8ade942c32 2026-06-18 12:43:39 +00:00 Compare
padreug deleted branch feat/event-detail-live-ticket-count 2026-06-18 12:44:10 +00:00
Sign in to join this conversation.
No description provided.