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

feat(MWPW-150610): implement partial load with background fetch #186

Merged
merged 5 commits into from
Nov 7, 2024

Conversation

sanrai
Copy link
Collaborator

@sanrai sanrai commented Oct 4, 2024

Performance Optimization for Large Card Collections

Problem

Large card collections (up to 4000 cards) were causing slow initial page load times and poor user experience.

Solution

This PR implements a two-phase loading strategy:

  1. Initially load a smaller subset of cards (e.g., 100) for immediate display.
  2. Load the remaining cards in the background after the initial render.

Changes

  • Added new configuration options in index.html:

    • partialLoadWithBackgroundFetch.enabled
    • partialLoadWithBackgroundFetch.partialLoadCount
  • Updated Container.jsx to implement the new loading strategy:

    • Added state management for total card count
    • Modified getCards function to support partial loading
    • Updated pagination and load more functionality to work with total card count
  • Adjusted various component props to use cardCount instead of gridCards.length

How to Test

  1. Configure a large card collection (1000+ cards)
  2. Enable partialLoadWithBackgroundFetch in the configuration
  3. Set partialLoadCount to a smaller number (e.g., 100)
  4. Load the page and observe:
    • Initial quick load with subset of cards
    • Background loading of remaining cards
    • Correct total card count in pagination/load more

Notes

  • This feature is optional and can be enabled/disabled via configuration
  • The partialLoadCount is configurable to allow fine-tuning based on specific use cases

Copy link
Collaborator

@cmiqueo cmiqueo left a comment

Choose a reason for hiding this comment

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

Shouldn't this PR include the build (dist/*) files?

@sanrai
Copy link
Collaborator Author

sanrai commented Oct 7, 2024

@cmiqueo thanks for catching two mistakes!

Shouldn't this PR include the build (dist/*) files?
This should be aria-label={title || 'Card Collection'}

This commit introduces a performance optimization for large card collections, specifically targeting collections with up to 4000 cards. It implements a new `partialLoadCount` feature to improve initial page load times and user experience.

The main changes include:
- Add new configuration options for partial load with background fetch
- Implement two-phase loading strategy in the Container component
- Update card count state management
- Adjust pagination and load more functionality to work with total card count
@sanrai sanrai merged commit de61214 into main Nov 7, 2024
10 checks passed
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.

3 participants