Skip to content

perf(dashboard): lazy-load usage analytics charts - #4466

Merged
diegosouzapw merged 6 commits into
diegosouzapw:release/v3.8.32from
KooshaPari:fix/dashboard-recharts-lazy-4436
Jun 21, 2026
Merged

diegosouzapw merged 6 commits into
diegosouzapw:release/v3.8.32from
KooshaPari:fix/dashboard-recharts-lazy-4436

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Lazy-load Recharts from the shared usage analytics chart components instead of importing it statically from the dashboard analytics bundle.
  • Split Recharts-backed analytics charts into focused modules so the frozen file-size and dead-code ratchets stay green.
  • Preserve existing no-data/no-cost branches so empty chart cards do not download the Recharts chunk.
  • Reset the dynamic import cache on chunk-load failure so a later render can retry.

Related Issues

Validation

  • npx prettier --write src/shared/components/analytics/charts.tsx src/shared/components/analytics/index.tsx src/shared/components/analytics/chartColors.ts src/shared/components/analytics/rechartsCore.tsx src/shared/components/analytics/rechartsUsageCharts.tsx src/shared/components/analytics/rechartsDonuts.tsx tests/unit/shared/analytics-recharts-lazy.test.ts
  • npx eslint src/shared/components/analytics/charts.tsx src/shared/components/analytics/index.tsx src/shared/components/analytics/chartColors.ts src/shared/components/analytics/rechartsCore.tsx src/shared/components/analytics/rechartsUsageCharts.tsx src/shared/components/analytics/rechartsDonuts.tsx tests/unit/shared/analytics-recharts-lazy.test.ts --quiet
  • node --import tsx/esm --test tests/unit/shared/analytics-recharts-lazy.test.ts
  • npm run check:file-size
  • npm run typecheck:core -- --pretty false
  • npm run build (passes; existing open-sse/services/browserPool.ts dynamic dependency warnings remain)
  • PR Test Policy local check after commit
  • Pre-commit/push: npx lint-staged, docs sync, npm run check:any-budget:t11, node scripts/check/check-tracked-artifacts.mjs
  • npm run test:unit
  • npm run test:coverage
  • CI coverage check passed
  • SonarQube PR analysis passed

Tests Added Or Updated

  • Added tests/unit/shared/analytics-recharts-lazy.test.ts to guard that Recharts is only imported through the lazy loader boundary.

Coverage Notes

  • Production code changed under src/shared/components/analytics/.
  • Covered by a focused unit test for the lazy-loading boundary, TypeScript, focused ESLint, file-size guard, production build, and commit/push hooks. Full unit and coverage suites were not run locally, but CI unit shards and coverage completed successfully.

Reviewer Notes

  • This is a first narrow slice for perf(dashboard): v3.8.31 production dashboard still loads multi-MB global font/icon/chart/provider assets #4436: it removes the shared usage analytics module's static Recharts dependency, but other dashboard pages still have separate static Recharts imports and can be handled in follow-up PRs.
  • Build output still reports the existing open-sse/services/browserPool.ts dynamic dependency warning; this PR does not touch that path.
  • The remaining Integration Tests (2/2) failure is inherited from upstream main at base SHA d0396c2 and fails the same chat-pipeline.test.ts and memory-pipeline.test.ts tests there.

@KooshaPari
KooshaPari requested a review from diegosouzapw as a code owner June 21, 2026 00:29
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@diegosouzapw
diegosouzapw force-pushed the fix/dashboard-recharts-lazy-4436 branch from 330dcce to 12cf707 Compare June 21, 2026 11:37
@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.8.32 June 21, 2026 11:37
@diegosouzapw
diegosouzapw merged commit 2f17be3 into diegosouzapw:release/v3.8.32 Jun 21, 2026
5 checks passed
@KooshaPari
KooshaPari deleted the fix/dashboard-recharts-lazy-4436 branch July 2, 2026 22:10
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
Thanks @KooshaPari! Rebased onto release/v3.8.32. Recharts now lazy-loads (public analytics API preserved, source-guard test included).
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