refactor: trim HomePage data layer to what the page actually renders#975
Open
cleanjunc wants to merge 2 commits intoentrius:testfrom
Open
refactor: trim HomePage data layer to what the page actually renders#975cleanjunc wants to merge 2 commits intoentrius:testfrom
cleanjunc wants to merge 2 commits intoentrius:testfrom
Conversation
Contributor
Author
|
@e35ventura @anderdc Could you please review this PR? Thanks! |
Collaborator
|
Fix conflicts. |
Contributor
Author
|
Hi @anderdc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HomePage.tsxwas callinguseDashboardData('35d'), a hook built for the authenticated dashboard. Tracing the destructure, onlydatasetsandisLoadingwere ever read, and even thendatasets.issues.datawas never referenced anddatasets.repos.data.lengthwas already covered byuseStats().uniqueRepositories, which the page also calls. Six memo pipelines insideuseDashboardData(kpis,overview,trendLabels,trendSeries,featuredWork,featuredContributors,featuredDiscoveryContributors) ran their full reductions on every dataset change for outputs that never reached HomePage's JSX.This PR switches the landing page to direct hooks for the data it actually consumes:
useAllPrs()for the activity feed, the 35 day merge count, and lifetime merged PRsuseAllMiners()for the top miner rows, miner count, and median merge rateuseStats()(already used) now also suppliesuniqueRepositories, replacing the count previously derived fromuseReposAndWeights()useDashboardDatastays untouched forDashboardPage, its only remaining caller. Module levelEMPTY_PRSandEMPTY_MINERSconstants keepuseMemodependency references stable before data lands, avoiding a needless recompute on the first data tick.Net effect on first paint of the public page: two fewer network requests (
/issuesand/dash/repos), and three featured pipelines stop running on every dataset refetch.Related Issues
/prsoverfetch (use repo-scoped query) #652 (repository view overfetch refactor); both reduce blast radius fromuseAllPrs()without depending on each otherQueryBoundary)Type of Change
Screenshots
Not applicable. No visual change; the rendered tree is identical.
Checklist
npm run formatandnpm run lint:fixhave been runnpm run buildpasses