Skip to content

Hwx/fix 93#95

Merged
kaola526 merged 13 commits intomainfrom
hwx/fix-93
Apr 14, 2026
Merged

Hwx/fix 93#95
kaola526 merged 13 commits intomainfrom
hwx/fix-93

Conversation

@kaola526
Copy link
Copy Markdown
Contributor

@kaola526 kaola526 commented Apr 1, 2026

  • Make data_size optional in the SearchResult interface in apiService.ts
  • Remove data_size: '' from CID search result (no longer needed)
  • Update Landing.tsx to skip the additional info row for cid type results, preventing misleading 0.00 B display

Copilot AI review requested due to automatic review settings April 1, 2026 01:32
@FilOzzy FilOzzy added this to FOC Apr 1, 2026
@github-project-automation github-project-automation bot moved this to 📌 Triage in FOC Apr 1, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the subgraph client to better support Piece CID workflows by adding paginated/batched fetching for piece details and enabling CID-based navigation from the landing page search.

Changes:

  • Add first/skip pagination parameters to the pieceDetails GraphQL query and implement batched loading in usePiecePageData.
  • Update PieceDetails page to rely on the hook’s returned dataset list for pagination.
  • Extend search to recognize Piece CIDs and route users to the piece details page (including network-prefixed routes).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
subgraph-client/src/utility/queries.ts Adds pagination args to pieceDetailsQuery to enable batched retrieval.
subgraph-client/src/hooks/usePiecePageData.tsx Implements batched fetching and deduplication for piece details data.
subgraph-client/src/pages/PieceDetails.tsx Simplifies pagination inputs by using the hook’s returned pieceDetails.
subgraph-client/src/api/apiService.ts Extends search result typing and adds CID result generation.
subgraph-client/src/pages/Landing.tsx Adds CID navigation behavior and updates routes to include network prefix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread subgraph-client/src/utility/queries.ts Outdated
Comment thread subgraph-client/src/pages/Landing.tsx Outdated
Comment on lines +253 to +257
{result.type === 'provider'
? `${result.active_sets} active sets`
: result.type === 'root'
? `${result.total_roots} roots`
: `${formatDataSize(result.data_size)}`}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

For cid search results, data_size is currently set to an empty string, so this UI falls through to formatDataSize(result.data_size) and renders 0.00 B, which is misleading. Consider omitting the size row for cid results or making data_size optional and only rendering it for result types that actually have a meaningful size.

Copilot uses AI. Check for mistakes.
Comment on lines 7 to 10
interface PiecePageOptions {
activityLimit?: number
retryOnError?: boolean
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

activityLimit remains in PiecePageOptions but is no longer used after removing the weekly activity query. Either remove this option or reintroduce the behavior so the hook API matches what it actually does.

Copilot uses AI. Check for mistakes.
Comment thread subgraph-client/src/hooks/usePiecePageData.tsx Outdated
Comment thread subgraph-client/src/api/apiService.ts Outdated
Comment on lines +63 to +69
if (cid) {
searchResults.push({
type: 'cid',
id: trimmedQuery,
data_size: '',
})
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

The cid search result is constructed with data_size: '' only to satisfy the type, which then propagates to the UI as a fake 0-byte size. Consider making data_size optional (or adding a dedicated field for CID results) and only setting it for result types where it’s meaningful.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done in commit 8bfb816. Made data_size optional in SearchResult, removed the data_size: '' from CID results, and updated Landing.tsx to skip the info row entirely for cid type results — so no more misleading 0.00 B display.

kaola526 and others added 2 commits April 1, 2026 10:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@BigLep BigLep moved this from 📌 Triage to 🔎 Awaiting review in FOC Apr 1, 2026
@kaola526
Copy link
Copy Markdown
Contributor Author

kaola526 commented Apr 1, 2026

fix #93

@beck-8
Copy link
Copy Markdown

beck-8 commented Apr 1, 2026

@copilot re-review

@beck-8
Copy link
Copy Markdown

beck-8 commented Apr 1, 2026

I have no insight into the code. Someone else needs to be reviewed.
I was satisfied with the actual effect and did not see any problems.

@rjan90 rjan90 requested a review from silent-cipher April 1, 2026 09:51
Copy link
Copy Markdown
Collaborator

@silent-cipher silent-cipher left a comment

Choose a reason for hiding this comment

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

If we move the cid check earlier to handleSearch, we can simplify Landing.tsx by removing several ternaries.

Comment thread subgraph-client/src/hooks/usePiecePageData.tsx Outdated
Comment thread subgraph-client/src/hooks/usePiecePageData.tsx Outdated
Comment thread subgraph-client/src/hooks/usePiecePageData.tsx Outdated
Comment thread subgraph-client/src/hooks/usePiecePageData.tsx Outdated
Comment thread subgraph-client/src/hooks/usePiecePageData.tsx Outdated
Comment thread subgraph-client/src/hooks/usePiecePageData.tsx Outdated
Comment thread subgraph-client/src/pages/Landing.tsx
@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to ⌨️ In Progress in FOC Apr 1, 2026
kaola526 and others added 5 commits April 2, 2026 06:08
Co-authored-by: Puspendra Mahariya <95584952+silent-cipher@users.noreply.github.com>
Co-authored-by: Puspendra Mahariya <95584952+silent-cipher@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Puspendra Mahariya <95584952+silent-cipher@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

@kaola526 kaola526 left a comment

Choose a reason for hiding this comment

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

fixed

@rjan90 rjan90 requested a review from silent-cipher April 3, 2026 04:36
Copy link
Copy Markdown
Collaborator

@silent-cipher silent-cipher left a comment

Choose a reason for hiding this comment

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

I don’t see this addressed yet, nor any discussion on it.

My main concern is: why aren’t we checking for cid at the start of handleSearch? If the input is a cid, we could directly navigate to /${network}/piece/<cid> instead of going through search and then checking results && results[0].type === 'cid'.

The current flow introduces an unnecessary round trip and triggers an avoidable subgraph API call.

Refs - #95 (comment) , #95 (comment)

@BigLep
Copy link
Copy Markdown
Contributor

BigLep commented Apr 8, 2026

@kaola526 : please re-request review when it's ready to be reviewed again?

@kaola526
Copy link
Copy Markdown
Contributor Author

kaola526 commented Apr 8, 2026

@kaola526 : please re-request review when it's ready to be reviewed again?:等准备好再次审核时请重新请求审核?

The modifications have been made as requested. Please help review it again. Thank you.

Comment thread subgraph-client/src/pages/Landing.tsx Outdated
Comment thread subgraph-client/src/pages/Landing.tsx Outdated
kaola526 and others added 2 commits April 11, 2026 11:10
Co-authored-by: Puspendra Mahariya <95584952+silent-cipher@users.noreply.github.com>
Co-authored-by: Puspendra Mahariya <95584952+silent-cipher@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this from ⌨️ In Progress to ✔️ Approved by reviewer in FOC Apr 14, 2026
@kaola526 kaola526 merged commit 929dac8 into main Apr 14, 2026
3 checks passed
@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

7 participants