Skip to content

Refactor dashboard data flow and add resilience - #1

Draft
Blackleets wants to merge 1 commit into
mainfrom
claude/project-summary-uqg02p
Draft

Blackleets wants to merge 1 commit into
mainfrom
claude/project-summary-uqg02p

Conversation

@Blackleets

Copy link
Copy Markdown
Owner

Summary

  • useAegisData hook — extracts ~200 lines of data-fetching logic from page.tsx into src/hooks/useAegisData.ts. activeLayers stays in the page as UI state; the hook takes it as a parameter and returns { data, backendStatus, globalStats, spaceWeather }.
  • Shared typessrc/lib/dashboard-types.ts centralises DashboardData, DashboardEntity, GlobalStats, SpaceWeather, and ActiveLayers so every component imports from one place.
  • Toast notification systemsrc/components/Toast.tsx with ToastProvider, useToast() hook, and animated dismissal via Framer Motion (ready to wire up to error events).
  • Per-panel ErrorBoundary — each panel (MarketsPanel, IntelFeed, ScmPanel, OsintPanel, LiveAlerts, AiAnalyst) is wrapped independently so a crash in one panel doesn't take down the whole dashboard.
  • Skeleton loadersMarketsPanel and IntelFeed now show animated animate-pulse placeholders while their data loads instead of rendering empty states.
  • Edge cache on /api/markets — changed from no-store to s-maxage=60, stale-while-revalidate=120, reducing upstream calls given the 15-minute polling interval.

Test plan

  • Dashboard loads without console errors
  • MarketsPanel shows skeleton while markets data is pending, then renders real data
  • IntelFeed shows skeleton while news data is pending, then renders real data
  • Crashing one panel (e.g. by injecting a bad prop) does not affect other panels
  • /api/markets response includes Cache-Control: public, s-maxage=60, stale-while-revalidate=120
  • All layer toggles (flights, satellites, fires, etc.) still fetch their endpoints correctly

🤖 Generated with Claude Code

https://claude.ai/code/session_01XgBr67RS2ki85QqAXau36C


Generated by Claude Code

…, toast system

- Extract all data-fetching logic from page.tsx into useAegisData hook
  (src/hooks/useAegisData.ts) keeping activeLayers as UI state in page
- Add shared type definitions in src/lib/dashboard-types.ts
- Add ToastProvider + useToast system (src/components/Toast.tsx)
- Wrap each panel in isolated ErrorBoundary so one crash doesn't kill the dashboard
- Add skeleton loaders (animate-pulse) to MarketsPanel and IntelFeed while data loads
- Add 60s edge cache on /api/markets (s-maxage=60, stale-while-revalidate=120)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XgBr67RS2ki85QqAXau36C
@Blackleets Blackleets changed the title refactor: extract data hook, add skeletons, error boundaries & toast system noop Jul 30, 2026
@Blackleets Blackleets changed the title noop Refactor dashboard data flow and add resilience Jul 30, 2026
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