Skip to content

perf(UI): optimize app initialization by parallelizing API calls and lazy loading components#6276

Open
balazs-szucs wants to merge 12 commits intoStirling-Tools:mainfrom
balazs-szucs:LCP
Open

perf(UI): optimize app initialization by parallelizing API calls and lazy loading components#6276
balazs-szucs wants to merge 12 commits intoStirling-Tools:mainfrom
balazs-szucs:LCP

Conversation

@balazs-szucs
Copy link
Copy Markdown
Collaborator

@balazs-szucs balazs-szucs commented Apr 30, 2026

Description of Changes

This pull request improves frontend performance and user experience by optimizing component loading and UI transitions, as well as enhancing app initialization efficiency. The most significant changes are the introduction of React lazy loading and Suspense for heavy components on the home page, targeted CSS transitions for smoother theme switching, and parallelizing critical API calls during app startup.

Performance and Loading Optimization:

  • Switched to React lazy and Suspense for heavy components (ToolPanel, Workbench, QuickAccessBar, RightRail, FileManager, AppConfigModal) in HomePage.tsx, enabling code-splitting and faster initial load times. A LoadingFallback component is shown while these components load.

  • Parallelized fetching of /api/v1/config/app-config and /api/v1/info/status in AppConfigProvider to reduce app initialization time and improve perceived performance.

UI and Theming Improvements:

  • Replaced the global CSS * transition rule with a more targeted [class*="mantine-"] selector for theme-related transitions, preventing unwanted transitions on non-theme elements.

  • Updated mantineTheme button styles to use more granular transition properties, resulting in smoother and more consistent visual feedback for theme changes and interactions.


Checklist

General

Documentation

Translations (if applicable)

UI Changes (if applicable)

  • Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)

Testing (if applicable)

  • I have run task check to verify linters, typechecks, and tests pass
  • I have tested my changes locally. Refer to the Testing Guide for more details.

@stirlingbot stirlingbot Bot added Front End Issues or pull requests related to front-end development perf Changes that improve performance labels Apr 30, 2026
@balazs-szucs balazs-szucs marked this pull request as ready for review April 30, 2026 14:15
Copilot AI review requested due to automatic review settings April 30, 2026 14:15
@dosubot dosubot Bot added size:L This PR changes 100-499 lines ignoring generated files. enhancement New feature or request labels Apr 30, 2026
@stirlingbot stirlingbot Bot removed the enhancement New feature or request label Apr 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 targets frontend perceived performance by reducing initial JS work via code-splitting on the Home page, smoothing theme-switch transitions, and shortening app bootstrap by fetching config alongside a status probe.

Changes:

  • Lazy-loads several heavy HomePage components with React.lazy + Suspense and introduces a shared loading fallback.
  • Updates AppConfigProvider to fetch app-config while also issuing a status request during initialization, and refactors “resolved” tracking to use a ref.
  • Narrows theme-switch CSS transitions (and makes Mantine button transitions more granular); updates AppConfigContext tests to account for the extra request.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/core/theme/mantineTheme.ts Replaces transition: all with targeted button transitions.
frontend/src/core/styles/theme.css Replaces global * transition rule with a Mantine-class-targeted selector.
frontend/src/core/pages/HomePage.tsx Converts several major components to lazy-loaded modules behind a Suspense boundary.
frontend/src/core/contexts/AppConfigContext.tsx Refactors resolved-config tracking to a ref and adds config+status fetching.
frontend/src/core/contexts/AppConfigContext.test.tsx Updates mocks/assertions to reflect the new status call and refetch behavior.

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

Comment thread frontend/src/core/contexts/AppConfigContext.tsx Outdated
Comment thread frontend/src/core/pages/HomePage.tsx Outdated
Comment thread frontend/src/core/styles/theme.css
Comment thread frontend/src/core/pages/HomePage.tsx Outdated
@jbrunton96
Copy link
Copy Markdown
Contributor

/deploypr

@stirlingbot stirlingbot Bot added the pr-deployed Pull request has been deployed to a test environment label May 1, 2026
@stirlingbot
Copy link
Copy Markdown
Contributor

stirlingbot Bot commented May 1, 2026

🚀 PR Test Deployment

Your PR has been deployed for testing!

🔗 Test URL: http://54.175.155.236:6276
Security Disabled

This deployment will be automatically cleaned up when the PR is closed.

@jbrunton96
Copy link
Copy Markdown
Contributor

Screen.Recording.2026-05-01.at.15.16.10.mov

I appreciate this might be too nitpicky, but there's some funny loading behaviour in this PR with things moving about on reload. Tool list is the most obvious place that this appears. Can we do anything about this to make sure it's always the same size before and after the contents has actually loaded in?

@balazs-szucs
Copy link
Copy Markdown
Collaborator Author

I appreciate this might be too nitpicky, but there's some funny loading behaviour in this PR with things moving about on reload. Tool list is the most obvious place that this appears. Can we do anything about this to make sure it's always the same size before and after the contents has actually loaded in?

No, that is one of the main goals of the PRs, so it is not nitpicky. It does look a bit weird, i'll see what i can do about it.

# Conflicts:
#	frontend/src/core/pages/HomePage.tsx
…g states and adjust layout for better responsiveness
@balazs-szucs
Copy link
Copy Markdown
Collaborator Author

/deploypr

@stirlingbot
Copy link
Copy Markdown
Contributor

stirlingbot Bot commented May 2, 2026

🚀 PR Test Deployment

Your PR has been deployed for testing!

🔗 Test URL: http://54.175.155.236:6276
Security Disabled

This deployment will be automatically cleaned up when the PR is closed.

@balazs-szucs
Copy link
Copy Markdown
Collaborator Author

/deploypr

@stirlingbot
Copy link
Copy Markdown
Contributor

stirlingbot Bot commented May 2, 2026

🚀 PR Test Deployment

Your PR has been deployed for testing!

🔗 Test URL: http://54.175.155.236:6276
Security Disabled

This deployment will be automatically cleaned up when the PR is closed.

@balazs-szucs
Copy link
Copy Markdown
Collaborator Author

/deploypr

@stirlingbot
Copy link
Copy Markdown
Contributor

stirlingbot Bot commented May 2, 2026

🚀 PR Test Deployment

Your PR has been deployed for testing!

🔗 Test URL: http://54.175.155.236:6276
Security Disabled

This deployment will be automatically cleaned up when the PR is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Front End Issues or pull requests related to front-end development perf Changes that improve performance pr-deployed Pull request has been deployed to a test environment size:L This PR changes 100-499 lines ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants