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

[MPP-3063] Reduce panel load time #498

Merged
merged 6 commits into from
Apr 20, 2023
Merged

Conversation

maxxcrawford
Copy link
Collaborator

@maxxcrawford maxxcrawford commented Apr 19, 2023

Summary

This PR reduces the load time when a user is logged in and opens the panels to view their masks.

This fixes:

TODO

  • Remove extra API call to get latest masks
    • Confirm other pages do not make the same call. Use local storage to power other panels (Stats)
  • Build initial masks lists on local (stale) date Disregarding for now
    • Update masks accordingly when API call finishes loading (add new masks, update status of other masks)
  • Move "save to local storage" logic when API is called for masks to background scripts
  • Edge case: Update mask view accordingly when API call finishes loading if on empty (no mask) state

Testing

For context, compare these actions to the production release with the same account.

  • If possible, use personal Relay account with 100+ accounts (May have to run $ npm run config:prod)
  • Log into account
  • Open panel
  • Expected: Panel should load within ~1s and the loading state should be visible until the data is shown
  • Open stats
  • Expected: Panel should load INSTANTLY with data

Screenshots

TBD

@maxxcrawford maxxcrawford changed the title MPP 3063 panel load time [MPP-3063] Reduce panel load time Apr 20, 2023
Copy link
Collaborator Author

@maxxcrawford maxxcrawford left a comment

Choose a reason for hiding this comment

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

Self-review. Came up with a few TODOs!

src/js/popup/popup.js Outdated Show resolved Hide resolved
Comment on lines +510 to +511
// Remove loading state
document.body.classList.remove("is-loading");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Context: Moved this to the end of the buildMasksList() function. Previously, we were removing the loading state too early.

src/js/popup/popup.js Outdated Show resolved Hide resolved

// Generate and append each mask item to the mask list
masks.forEach( mask => {
const maskListItem = popup.panel.masks.utilities.buildMaskListItem(mask);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Context: This function was getting really big. Broke out the buildMaskListItem iteration to make it easier to read.

Comment on lines +584 to +585
// TODO: Add toggle button back
// maskListItemAddressActions.append(maskListItemToggleButton);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Disregard this TODO. It is part of #473

src/js/popup/popup.js Outdated Show resolved Hide resolved
@maxxcrawford maxxcrawford linked an issue Apr 20, 2023 that may be closed by this pull request
@maxxcrawford maxxcrawford marked this pull request as ready for review April 20, 2023 19:11
@maxxcrawford maxxcrawford self-assigned this Apr 20, 2023
@maxxcrawford maxxcrawford merged commit 8ca9c92 into main Apr 20, 2023
3 checks passed
@maxxcrawford maxxcrawford deleted the MPP-3063-panel-load-time branch April 20, 2023 20:05
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.

bad perceived performance of opening the panel
2 participants