src/pages/HomePage.tsx calls useDashboardData('35d') on line 246. That hook (src/pages/dashboard/useDashboardData.ts) was built for the authenticated dashboard and returns nine fields. Tracing the destructure on line 246, only datasets and isLoading are read. Going further:
datasets.miners.data is used for buildTopMinerRows, medianMergeRate, and minerCount. Needed.
datasets.prs.data is used for buildActivityRows, countMergedPrsInWindow, and totalMergedPrsEver. Needed.
datasets.repos.data.length is the only thing read from the repos query (line 266). The same number is already returned by useStats().uniqueRepositories, which the page already calls on line 247.
datasets.issues.data is not referenced anywhere in HomePage.tsx. The useIssues() query inside useDashboardData runs purely for the authenticated dashboard.
kpis, overview, trendLabels, trendSeries, featuredWork, featuredContributors, featuredDiscoveryContributors are each computed via useMemo on every dataset change. None of them appear in HomePage's JSX.
Two practical effects on the public landing page:
- Two extra network requests fire on every first paint.
useIssues() is never read on this page, and useReposAndWeights() only contributes a count that useStats() already returns.
- The three
featured-* memos run their full pipelines whenever the dashboard cache changes, even though their outputs never reach the rendered tree.
Suggested direction:
- Keep
useDashboardData for DashboardPage.
- Switch
HomePage to direct calls for the data it actually needs: useAllMiners() plus useAllPrs() for the rows, and the existing useStats() for uniqueRepositories, totalLinesChanged, totalCommits, and totalIssues.
- Drop the references to the unused fields so the dashboard hook remains lean for its primary caller.
Net effect: first paint on the public page issues two fewer requests, and the React tree stops paying for memo work whose result is never displayed.
Related
The dependency on useDashboardData was added when the landing page was rebuilt in #950 and #938. The currently open #971 / #970 polish copy and layout on the same page, but neither touches the data layer.
The closest sibling concern is #652 (refactor repository views to avoid global /prs overfetch), which scopes itself to RepositoryPRsTable, RepositoryStats, and RepositoryContributorsTable and explicitly leaves the landing page out of scope. The fix proposed here does not require the new repo-scoped hook from #652 to land first; the two are independent and both reduce blast radius from useAllPrs() and friends.
#347 (consolidate loading / error / empty states via QueryBoundary) is the broader cleanup of how data hooks are consumed across pages and is loosely adjacent.
src/pages/HomePage.tsxcallsuseDashboardData('35d')on line 246. That hook (src/pages/dashboard/useDashboardData.ts) was built for the authenticated dashboard and returns nine fields. Tracing the destructure on line 246, onlydatasetsandisLoadingare read. Going further:datasets.miners.datais used forbuildTopMinerRows,medianMergeRate, andminerCount. Needed.datasets.prs.datais used forbuildActivityRows,countMergedPrsInWindow, andtotalMergedPrsEver. Needed.datasets.repos.data.lengthis the only thing read from the repos query (line 266). The same number is already returned byuseStats().uniqueRepositories, which the page already calls on line 247.datasets.issues.datais not referenced anywhere inHomePage.tsx. TheuseIssues()query insideuseDashboardDataruns purely for the authenticated dashboard.kpis,overview,trendLabels,trendSeries,featuredWork,featuredContributors,featuredDiscoveryContributorsare each computed viauseMemoon every dataset change. None of them appear in HomePage's JSX.Two practical effects on the public landing page:
useIssues()is never read on this page, anduseReposAndWeights()only contributes a count thatuseStats()already returns.featured-*memos run their full pipelines whenever the dashboard cache changes, even though their outputs never reach the rendered tree.Suggested direction:
useDashboardDataforDashboardPage.HomePageto direct calls for the data it actually needs:useAllMiners()plususeAllPrs()for the rows, and the existinguseStats()foruniqueRepositories,totalLinesChanged,totalCommits, andtotalIssues.Net effect: first paint on the public page issues two fewer requests, and the React tree stops paying for memo work whose result is never displayed.
Related
The dependency on
useDashboardDatawas added when the landing page was rebuilt in #950 and #938. The currently open #971 / #970 polish copy and layout on the same page, but neither touches the data layer.The closest sibling concern is #652 (refactor repository views to avoid global
/prsoverfetch), which scopes itself toRepositoryPRsTable,RepositoryStats, andRepositoryContributorsTableand explicitly leaves the landing page out of scope. The fix proposed here does not require the new repo-scoped hook from #652 to land first; the two are independent and both reduce blast radius fromuseAllPrs()and friends.#347 (consolidate loading / error / empty states via
QueryBoundary) is the broader cleanup of how data hooks are consumed across pages and is loosely adjacent.