feat(dashboard): custom date range + KPI port-hydration gate

DateRangePicker grows a "Custom range" mode (From/To inputs capped
at today, mutually-bounded so From <= To). dashboard-shell threads
the range through to /api/v1/analytics, which validates calendar
dates via ISO round-trip and enforces a 365-day cap as a backstop
against the occupancy timeline N+1.

KpiCards now gates its query on currentPortId so the early
unhydrated-store fetch can't cache a zeroed/error response and
display "-" until staleTime expires.

MyRemindersRail drops xl:h-full so the rail no longer stretches
past its grid row and overlaps ActivityFeed below.

useRealtimeInvalidation switches to partial-prefix queryKeys so a
realtime mutation invalidates every cached range bucket at once
instead of just the one currently visible.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Ciaccio
2026-05-04 22:54:55 +02:00
parent e598cc0708
commit 77ad10ced1
7 changed files with 260 additions and 30 deletions

View File

@@ -12,7 +12,7 @@ export type { EventMap, SocketLike } from '@/hooks/realtime-invalidation-core';
/**
* Subscribes to socket events and invalidates React Query caches.
*
* Safe to call with an inline-literal `eventMap` the hook only re-subscribes
* Safe to call with an inline-literal `eventMap` - the hook only re-subscribes
* when the SET of event keys actually changes (not when the object identity
* changes). The latest query-key list is read at event fire-time via a ref.
*
@@ -39,7 +39,7 @@ export function useRealtimeInvalidation(eventMap: EventMap) {
useEffect(() => {
if (!socket) return;
// eventMapRef is intentionally not in deps it's a ref; we only want to
// eventMapRef is intentionally not in deps - it's a ref; we only want to
// re-run when the socket, queryClient, or the event-key SET changes.
return subscribeRealtimeInvalidations(
socket,