perf: improve flashy loading while lazy loading #1319

Closed
opened 2026-04-05 16:26:47 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @soknaly on 12/13/2023

Improve flashy loading when lazy loading

After introducing lazy loading, I noticed an unpleasant User Experience when the pages were loaded along with the sidebar. So instead of lazy loading the whole page, we only lazy load the sub-page which so the loading indicator only shows in the content panel at the right side of the sidebar.

Following react-router-dom v6, we can take advantage of Outlet to simplify this.

This change includes the following

  • Breadcrumbs link will be no longer specified on each page, instead, we use the function to build breadcrumbs links for each path map.
  • Breadcrumbs are now generated by using the function BuildBreadcrumbLinksByTitles.
    • Project -> Monitors -> View Monitor -> Custom Fields represented by /dashboard/:projectId/monitors/:id/custom-fields
    • Breaking down breadcrumb with a link representation for each item (reversed)
      • Custom Fields = /dashboard/:projectId/minitors/:id/custom-fields (current pathname)
      • View Monitor = /dashboard/:projectId/monitors/:id (current pathname - 1)
      • Monitors = /dashboard/:projectId/monitors (current pathname - 2)
      • Project = /dashboard/:projectId (current pathname - 3)
  • This is how I expected breadcrumbs to be. If in any case breadcrumbs behave differently, we can use this BuildBreadcrumbLinks
  • Each sub-page no longer needs to use ModelPage as it's been covered in its container component along with Outlet component.

Pull Request Checklist:

  • Please make sure all jobs pass before requesting a review.
  • Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).
  • Have you lint your code locally before submission?
  • Did you write tests where appropriate?

Screenshots (if appropriate):

Before

https://github.com/OneUptime/oneuptime/assets/20983608/02b6450c-6b32-4c2c-8fc2-d585b949a386

After

https://github.com/OneUptime/oneuptime/assets/20983608/44c3130f-b62a-41cf-a2ae-c16aed1682bd

*Originally created by @soknaly on 12/13/2023* ### Improve flashy loading when lazy loading After introducing lazy loading, I noticed an unpleasant User Experience when the pages were loaded along with the sidebar. So instead of lazy loading the whole page, we only lazy load the sub-page which so the loading indicator only shows in the content panel at the right side of the sidebar. Following `react-router-dom` v6, we can take advantage of `Outlet` to simplify this. **This change includes the following** - Breadcrumbs link will be no longer specified on each page, instead, we use the function to build breadcrumbs links for each path map. - Breadcrumbs are now generated by using the function `BuildBreadcrumbLinksByTitles`. - Project -> Monitors -> View Monitor -> Custom Fields represented by `/dashboard/:projectId/monitors/:id/custom-fields` - Breaking down breadcrumb with a link representation for each item (reversed) - Custom Fields = `/dashboard/:projectId/minitors/:id/custom-fields` (current pathname) - View Monitor = `/dashboard/:projectId/monitors/:id` (current pathname - 1) - Monitors = `/dashboard/:projectId/monitors` (current pathname - 2) - Project = `/dashboard/:projectId` (current pathname - 3) - This is how I expected breadcrumbs to be. If in any case breadcrumbs behave differently, we can use this `BuildBreadcrumbLinks` - Each sub-page no longer needs to use `ModelPage` as it's been covered in its container component along with `Outlet` component. ### Pull Request Checklist: - [ ] Please make sure all jobs pass before requesting a review. - [ ] Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such). - [x] Have you lint your code locally before submission? - [ ] Did you write tests where appropriate? ### Related Issue? ### Screenshots (if appropriate): #### Before https://github.com/OneUptime/oneuptime/assets/20983608/02b6450c-6b32-4c2c-8fc2-d585b949a386 #### After https://github.com/OneUptime/oneuptime/assets/20983608/44c3130f-b62a-41cf-a2ae-c16aed1682bd
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/oneuptime#1319