[codex] Make Electric-backed UI cache-first
Merged
KI
6mo ago+100+100+012345678901234567890123456789-95-95-01234567890123456789
Summary
- Render cached Electric/TanStack DB rows before collection readiness flags on v2 workspace, automations, and settings surfaces.
- Use
isReadyonly to decide loading vs empty/not-found when no row exists yet. - Remove the resource monitor metadata readiness gate so metrics can render with fallback names and cached metadata enrichment.
Why
During an Electric outage or slow shape hydration, useLiveQuery can still expose persisted rows while isReady is false. UI code that blanked or skeletoned on readiness alone could hide valid cached data, which matched the blank workspace/settings reports during the 1.9.9 upgrade window.
Validation
bun test apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/ResourceConsumption/resourceConsumptionPolicy.test.tsbun run --cwd apps/desktop typecheckbun run lintgit diff --check
Summary by cubic
Make the Electric-backed UI cache-first so cached rows render immediately instead of blank states when isReady is false, and remove metadata gating from the Resource Monitor. Document the cache-first useLiveQuery policy in AGENTS.md.
- Bug Fixes
- Render cached rows before readiness across v2 workspace layout, automations (list/detail), and settings (account, API keys, members/invitations, teams, hosts, projects, organization, v2 project). Show loading only when not ready and no cached rows; show empty/not-found only after readiness.
- Resource Monitor: drop v2 metadata readiness gate; start polling only when the popover opens; keep label enrichment from cached project/workspace data; update policy and tests.
useCurrentPlan: treat subscriptions as loaded when cached and returnisReadyaccordingly.- Host/workspace readiness:
useWorkspaceHostUrl,useRemoteHostStatus, and v2 workspace layout now gate on “not ready AND no row,” preventing blank UIs. - Refined empty-state gating on projects/hosts and automations pages to avoid premature “No items” messages.
Summary by CodeRabbit
Release Notes
-
Bug Fixes
- Fixed loading state display across multiple pages, including automations, account settings, API keys, hosts, members, organization, projects, and teams.
- Improved "not found" messaging when requested data is unavailable.
- Resolved UI timing issues during initial data synchronization to prevent premature empty-state display.
- Enhanced loading skeletons to display correctly while data is being fetched.
-
Documentation
- Added guidelines for proper data-loading patterns with real-time database queries.