Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task: Implement lazy loading #2229

Merged
merged 42 commits into from
Aug 17, 2023
Merged

Task: Implement lazy loading #2229

merged 42 commits into from
Aug 17, 2023

Conversation

Onokaev
Copy link
Contributor

@Onokaev Onokaev commented Nov 10, 2022

Overview

Implements #2228

Demo

Optional. Screenshots, curl examples, etc.
image
Chunks before lazy loading

image

Chunks after lazy loading

Notes

Currently, Graph Explorer is loaded in a single bundle. With the app growing, this bundle is also increasing in size. The current bundle has a size a little over 1MB. This has an impact on the app load time as the whole bundle has to be loaded first for the app to become usable

Lazy loading splits the original bundle into smaller chunks so that what is needed on first-load is what is loaded initially. The lazily loaded components will be in their own chunks and will be loaded on demand

Testing Instructions

  • How to test this PR
    Load the app on your browser
    Click 'Request headers' tab
    Notice that it is loaded on demand
    Click on other components (Modify Permissions, Access token, Response headers, Resources etc.)

Copy link
Collaborator

@thewahome thewahome left a comment

Choose a reason for hiding this comment

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

Let's have the PR body explain Please also mention in the PR description the gains expected.
Are we aiming to reduce bundle size? How much does the work in this PR save us?

IMHO it could be that the network calls we are making on the first load are expensive. And that it could be unrelated to lazy loading the different tabs.

We can also analyse whether GE with the Dev portal chrome around it gives us the same load time as GE without the portal chrome. Then see whether it's the extra html added during production that affects the initial load time

@Onokaev Onokaev marked this pull request as draft November 21, 2022 13:25
@Onokaev Onokaev marked this pull request as ready for review November 25, 2022 09:49
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Onokaev Onokaev added the status:needs-discussion An issue that requires more discussion internally before resolving label Jan 24, 2023
Copy link
Collaborator

@thewahome thewahome left a comment

Choose a reason for hiding this comment

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

Since some components are not immediately with the client when the page loads, they may fail to get downloaded eventually when needed due to various reasons. It would make sense to add an ErrorBoundary wrapped around the SuspenseLoader

Copy link
Collaborator

@thewahome thewahome left a comment

Choose a reason for hiding this comment

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

We are going to add a lot of SuspenseLoaders everywhere.

It's probably possible for us to have a component registry where we register the suspended components and import them in the required files without adding the suspense and error boundaries.

If successful, it could mean we would be changing only where the components are imported from and not how they are imported.

e.g.
import { Permission } from 'component-registry'; instead of const Permission = lazy(() => import('../../query-runner/request/permissions'))

@Onokaev Onokaev marked this pull request as draft February 20, 2023 16:16
@github-actions
Copy link
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-sand-0ac78c710-2229.centralus.azurestaticapps.net

@github-actions
Copy link
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-sand-0ac78c710-2229.centralus.azurestaticapps.net

1 similar comment
@github-actions
Copy link
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-sand-0ac78c710-2229.centralus.azurestaticapps.net

@Onokaev Onokaev requested a review from gavinbarron August 3, 2023 18:08
@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2023

Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-sand-0ac78c710-2229.centralus.azurestaticapps.net

@github-actions
Copy link
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-sand-0ac78c710-2229.centralus.azurestaticapps.net

gavinbarron
gavinbarron previously approved these changes Aug 14, 2023
Copy link
Member

@gavinbarron gavinbarron left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-sand-0ac78c710-2229.centralus.azurestaticapps.net

Copy link
Collaborator

@thewahome thewahome left a comment

Choose a reason for hiding this comment

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

Noticed a few typos

@github-actions
Copy link
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://jolly-sand-0ac78c710-2229.centralus.azurestaticapps.net

@gavinbarron
Copy link
Member

Noticed a few typos

Nice spotting @thewahome
I'd suggest that everyone uses the CSpell extension for VSCode, it really helps catch those kind of typos early.

@thewahome
Copy link
Collaborator

@gavinbarron I'll add it as a recommended extension

@Onokaev Onokaev merged commit 7d6104a into dev Aug 17, 2023
@Onokaev Onokaev deleted the task/implement-lazy-loading branch August 17, 2023 21:09
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@thewahome thewahome mentioned this pull request Nov 3, 2023
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.

4 participants