Skip to content

Integrate session state into the central state tier#30

Merged
SBalaguer merged 8 commits into
mainfrom
sb/fix/multiple-sessions-fix
Jun 16, 2026
Merged

Integrate session state into the central state tier#30
SBalaguer merged 8 commits into
mainfrom
sb/fix/multiple-sessions-fix

Conversation

@SBalaguer

@SBalaguer SBalaguer commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

PR #21 hardened festival state into a single reactive tier (monotonic merge + pending overlay, fed by one watchBest() follow), but the wiring only covered the festival contract. Each FestivalSession is its own contract, so session-level state was left on the old per-component model. This caused four bugs, all from the same root:

Current state

  • Joiner count was slow/stale. Nothing updated a session's registeredCount live (the festival watcher filters to one contract; useSessionWatcher didn't handle Registered). It moved only on a full reconcile.
  • Badge animation misfired. Driven by a per-session follow that was fragile under the host follow budget (missed the event → didn't fire from the QR screen) and replay-sensitive (watchBest replays on resubscribe → fired twice on re-entry).
  • Program didn't pull new sessions live. The single festival follow competed with per-session follows and stalled under budget pressure; new sessions appeared only on refresh.
  • Session edits weren't reflected. handleUpdateMetadata wrote optimistically to a local ref only, never into shared

Changes

  • One follow, dispatch by contract. Generalized the event watcher to route events to handlers keyed by emitting contract (the festival plus every session) over a single chainHead follow. Eliminates per-session follows and the follow-budget exhaustion.
  • Session events through the merge tier. New applySessionRegistered / applySessionCheckedIn / applySessionMetadataUpdated helpers, replay-safe (registered count guarded by the unseen-row check, grounded by the reconcile's maxBig).
  • Per-session, once-ever badge. Celebration now keys off shared check-in state plus a persisted per-session guard, so it fires once from the QR screen and never repeats on re-entry or reload.
  • Session edits via the pending overlay. New editSession pending kind surfaces edits instantly across all views and rolls back on tx failure.
  • It makes session time not editable, in line with contracts
  • It re-directs users to session detail page after successful edit
  • It fixes POAP reading upon checkin.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Preview Deployment Ready!

App Domain
Admin pr30-manager
Festival pr30-attendee
Deployment Details
App CID
Admin bafybeigc57q6fhvmxagaxkdgzzjgemoadptbsnvx7ssfstxogxueantd5a
Festival bafybeiaj4atw6aju7kysbo2qnwcj42klfmptubgmezvrc6yc5heac2ra3u
Info Value
Commit 797f7b0b54acf33db4ad43763027e53d96793e29
Branch sb/fix/multiple-sessions-fix

Updates automatically on each push. View workflow run

@SBalaguer SBalaguer mentioned this pull request Jun 16, 2026

@tiagobndr tiagobndr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@SBalaguer SBalaguer merged commit 0421df7 into main Jun 16, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants