Skip to content

fix: 🐛 keep dining hall open/closed status live (#501)#748

Closed
wilyan09007 wants to merge 1 commit into
devfrom
501/live-hall-status
Closed

fix: 🐛 keep dining hall open/closed status live (#501)#748
wilyan09007 wants to merge 1 commit into
devfrom
501/live-hall-status

Conversation

@wilyan09007
Copy link
Copy Markdown
Contributor

@wilyan09007 wilyan09007 commented May 21, 2026

Summary

The dining hall's Open/Closed status was derived from a selectedDate that is frozen when the app loads and a today captured once when the restaurant store is created, and nothing re-derived it on a timer. If you left a hall page open across an open→close transition, the status stayed stale (e.g. still showing Open after the hall had actually closed) until you refreshed the page.

This adds a live now clock to the restaurant store that ticks every 30 seconds while a hall page is mounted, and uses it as the reference time for the open/close window when you're viewing today. Any other selected day keeps comparing against the selected date, so its behavior is unchanged.

Changes

  • useRestaurantStore: add a now: Date field (plus setNow) to the store
  • useHallDerived: compare the open/close window against the live now when the selected day is today (falls back to selectedDate for any other day, preserving existing behavior)
  • useRestaurantPage: tick now every 30s via setInterval while a hall page is mounted, cleaning up the interval on unmount

Testing Instructions

No local setup changes are needed beyond the usual dev environment.

  1. Open the Anteatery or Brandywine page a few minutes before a meal-period boundary (an open→close or close→open time).
  2. Leave the page open — do not refresh — and watch the status indicator (the colored dot + "Open"/"Closed" text, shown in the desktop controls and the mobile hero).
  3. When the clock passes the boundary, the status should flip on its own within ~30s.
  4. Sanity check that selecting a non-today date still shows its menu as before, and that selecting today reflects the current open/closed state.

Closes #501

The derived hall status was computed from a selectedDate frozen at app load
and a today captured once at store creation, with nothing re-deriving on a
timer. Leaving a hall page open across an open->close switch left the status
stale (e.g. still Open after the hall closed) until refresh.

Add a now clock to the restaurant store that ticks every 30s while a hall page
is mounted, and use it as the reference time for the open/close window when
viewing today. Other selected days are unaffected.

Closes #501
@wilyan09007 wilyan09007 temporarily deployed to staging-748 May 21, 2026 20:28 — with GitHub Actions Inactive
@github-actions github-actions Bot temporarily deployed to staging-748 May 21, 2026 20:29 Inactive
@wilyan09007 wilyan09007 deleted the 501/live-hall-status branch May 21, 2026 20:58
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.

1 participant