Skip to content

feat(planet): implement progressive rendering for project gallery#6570

Open
e-esakman wants to merge 1 commit intosugarlabs:masterfrom
e-esakman:fix-globalplanet
Open

feat(planet): implement progressive rendering for project gallery#6570
e-esakman wants to merge 1 commit intosugarlabs:masterfrom
e-esakman:fix-globalplanet

Conversation

@e-esakman
Copy link
Copy Markdown

@e-esakman e-esakman commented Apr 12, 2026

Summary

Improves project loading in GlobalPlanet by introducing progressive rendering. Projects are now displayed incrementally as their data arrives instead of waiting for all requests to complete.

Problem

The previous implementation of downloadProjectsToCache followed an "all-or-nothing" approach:

  • Used individual XHR requests for each project (N+1 pattern)
  • Waited for all requests to complete before rendering
  • Rendered everything in a single batch

Impact:

  • Users experienced long loading times (10+ seconds on slow connections)
  • UI remained blank with only a loading spinner
  • Poor perceived performance due to the N+1 request pattern

PR Category

  • Bug Fix - Fixes a bug or incorrect behavior
  • Feature - Adds new functionality
  • Performance - Improves performance
  • Tests - Adds or updates test coverage
  • Documentation - Updates docs

Key Changes

  • Separated fetching and rendering: Introduced renderSingleProjectSafe to inject cards into the DOM immediately upon successful request completion.
  • Guards for Duplicate Rendering: Added checks against this.cards to prevent duplicate project cards during asynchronous race conditions
  • DOM Efficiency: Refactored jQuery.tooltip initialization to fire once per batch instead of per project, reducing redundant DOM traversal and reduncing unnecessary CPU call.
  • Improved Error Handling: The "Feature unavailable" message is now triggered only if the entire batch fails. If at least one project loads, the UI still displays available content

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • I have followed the project's coding style guidelines.
  • I have run npm run lint and npx prettier --check . with no errors.
  • I have addressed the code review feedback from the previous submission, if applicable.

Notes

  • this PR does not eliminate the N+1 request pattern at the network level, as the current API only provides per-project detail endpoints.
  • it improves UX by mitigating its impact through progressive rendering.

@e-esakman e-esakman changed the title fix:improve project loading in GlobalPlanet feat(planet): implement progressive rendering for project gallery Apr 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@github-actions github-actions bot added performance Improves performance (load time, memory, rendering) size/M Medium: 50-249 lines changed feature Adds new functionality labels Apr 12, 2026
@zealot-zew
Copy link
Copy Markdown
Contributor

There is a duplicate PR #6101 on the same feature you are trying to work. i suppose the other PR is tend to go stale, so your PR is a good addition. you can refer to that PR if that helps making better contribution, in the mean time ill give this a test.

Copy link
Copy Markdown
Contributor

@zealot-zew zealot-zew left a comment

Choose a reason for hiding this comment

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

It working good. Planet seems to be slow, but its fine for now.

Screen.Recording.2026-04-13.093059.mp4

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

Labels

feature Adds new functionality performance Improves performance (load time, memory, rendering) size/M Medium: 50-249 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants