Skip to content

Refactor dashboard logic#175

Open
severo wants to merge 6 commits into
mainfrom
refactor-dashboard-logic
Open

Refactor dashboard logic#175
severo wants to merge 6 commits into
mainfrom
refactor-dashboard-logic

Conversation

@severo

@severo severo commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Use an error boundary, and suspense, instead of useEffect.

I also fixed the color of the loading spinner (blue -> "accent" == light green)

Also fixed a detail (isNaN -> Number.isNaN)

Error:

Capture d’écran du 2026-06-25 10-30-48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the All4Trees dashboard page to use React Suspense + use() for data loading and an error boundary for failures, while also adjusting the loading spinner styling and adding localized error strings.

Changes:

  • Split dashboard into Dashboard (data fetch via use()), LoadedDashboard (render UI), and Loading (spinner) components.
  • Wrap the dashboard page with <ErrorBoundary> and <Suspense> and add i18n strings for error display.
  • Replace isNaN with Number.isNaN in year parsing.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
webapp/src/widgets/dashboard/loading.tsx Adds a dedicated Suspense fallback spinner component using the “accent” color.
webapp/src/widgets/dashboard/loaded-dashboard.tsx Extracts the “loaded” dashboard UI and data formatting.
webapp/src/widgets/dashboard/error-boundary-fallback.tsx Adds a reusable error-boundary fallback render function using i18n.
webapp/src/widgets/dashboard/dashboard.tsx Introduces Suspense use()-based data fetching with a cached Promise.
webapp/src/pages/all4trees/dashboard.tsx Replaces useEffect loading with ErrorBoundary + Suspense composition.
webapp/src/shared/i18n/translations/fr/all4trees.json Adds FR dashboard error strings.
webapp/src/shared/i18n/translations/en/all4trees.json Adds EN dashboard error strings.
webapp/package.json Adds react-error-boundary dependency.
webapp/package-lock.json Locks react-error-boundary dependency.
Files not reviewed (1)
  • webapp/package-lock.json: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread webapp/src/widgets/dashboard/dashboard.tsx Outdated
Comment thread webapp/src/widgets/dashboard/loaded-dashboard.tsx
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