Skip to content

Perf/memoize pinned top repos 1458#2222

Open
Antra1705 wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
Antra1705:perf/memoize-pinned-top-repos-1458
Open

Perf/memoize pinned top repos 1458#2222
Antra1705 wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
Antra1705:perf/memoize-pinned-top-repos-1458

Conversation

@Antra1705

Copy link
Copy Markdown
Contributor

Summary

Refined the custom comparator for the memoized RepoItem component in TopRepos.tsx to fix missing equality checks that caused stale UI states during real-time SSE sync events.

Closes #1458


Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added shallow equality checks on repo.url and repo.description in the RepoItem comparator
  • Added deep equality check on repo.languages array to prevent stale language badges
  • Added deep equality check on health.signals to prevent stale health tooltips
  • Extracted helper functions areLanguagesEqual and areHealthSignalsEqual to keep comparator logic self-contained

How to Test

  1. Run npm run dev and open the dashboard
  2. Open React DevTools Profiler and record while typing in the search bar or switching account contexts
  3. Verify that RepoItem components with unchanged data do not re-render

Screenshots (if UI change)

N/A


Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • npm run build succeeds
  • Self-reviewed the diff
  • Added/updated tests if applicable

Additional Notes

Core React.memo wrappers for RepoItem and RepoCard were introduced in PR #1503. This PR refines the comparator logic only — no structural changes to component hierarchy.

The failing E2E check (streak freeze API in e2e/streak.spec.ts:229) is unrelated to this PR's changes, which are scoped to TopRepos.tsx only. Confirmed pre-existing on main — caused by setupStreakMocks returning an empty contributions object, triggering an early return in StreakTracker.tsx before the freeze button renders.

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

@Antra1705 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:performance GSSoC type bonus: performance (+15 pts) labels Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

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

Labels

gssoc26 GSSoC 2026 contribution type:performance GSSoC type bonus: performance (+15 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(render): Memoize PinnedRepos and TopRepos Components to Prevent Redundant Re-Renders

1 participant