-
Notifications
You must be signed in to change notification settings - Fork 20
feat: enhance ProjectCard to display network type and update useProjectList for manifest retrieval #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ctList for manifest retrieval
📝 WalkthroughWalkthroughReplaces IndexerName usage with a network name resolver and truncation logic in ProjectCard and ProjectHeader, adds a getNetworkNameByChainId helper with expanded network dictionaries and DEV-mode logging for unmapped chain IDs, makes manifest lookup always use the provided deploymentId, and adds minor repo config changes. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
…c.yml configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/components/ProjectCard/ProjectCard.tsx`:
- Around line 54-69: In ProjectCard's networkVal useMemo the RPC branch returns
project.manifest.rpcFamily[0] without checking length, which yields undefined
for an empty array; update the RPC branch in networkVal (used in ProjectCard
when project.type === ProjectType.RPC) to check that
project.manifest?.rpcFamily?.length > 0 and return the first element only then,
otherwise fall back to '-' (or the existing downstream fallback), ensuring
project.manifest.rpcFamily is safely handled.
| const networkVal = React.useMemo(() => { | ||
| if (project.type === ProjectType.RPC && project.manifest?.rpcFamily) { | ||
| return project.manifest.rpcFamily[0]; | ||
| } | ||
|
|
||
| const chainId = | ||
| project.type === ProjectType.SUBQUERY | ||
| ? project.manifest?.network?.chainId | ||
| : project.manifest?.dataSources?.[0]?.network; | ||
| if (!chainId) return '-'; | ||
|
|
||
| const polkadotName = NETWORK_TYPE_DICTION[chainId]; | ||
| const ethName = ETH_TYPE_DICTION[chainId]; | ||
|
|
||
| return polkadotName || ethName || `Chain ID ${chainId}`; | ||
| }, [project.type, project.manifest]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edge case: empty rpcFamily array returns undefined.
If rpcFamily is an empty array [], the condition on line 55 evaluates to truthy, and rpcFamily[0] returns undefined. While downstream code handles this via ${networkVal || '-'} fallback, explicitly checking array length would make the intent clearer.
Suggested improvement
const networkVal = React.useMemo(() => {
- if (project.type === ProjectType.RPC && project.manifest?.rpcFamily) {
+ if (project.type === ProjectType.RPC && project.manifest?.rpcFamily?.length) {
return project.manifest.rpcFamily[0];
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const networkVal = React.useMemo(() => { | |
| if (project.type === ProjectType.RPC && project.manifest?.rpcFamily) { | |
| return project.manifest.rpcFamily[0]; | |
| } | |
| const chainId = | |
| project.type === ProjectType.SUBQUERY | |
| ? project.manifest?.network?.chainId | |
| : project.manifest?.dataSources?.[0]?.network; | |
| if (!chainId) return '-'; | |
| const polkadotName = NETWORK_TYPE_DICTION[chainId]; | |
| const ethName = ETH_TYPE_DICTION[chainId]; | |
| return polkadotName || ethName || `Chain ID ${chainId}`; | |
| }, [project.type, project.manifest]); | |
| const networkVal = React.useMemo(() => { | |
| if (project.type === ProjectType.RPC && project.manifest?.rpcFamily?.length) { | |
| return project.manifest.rpcFamily[0]; | |
| } | |
| const chainId = | |
| project.type === ProjectType.SUBQUERY | |
| ? project.manifest?.network?.chainId | |
| : project.manifest?.dataSources?.[0]?.network; | |
| if (!chainId) return '-'; | |
| const polkadotName = NETWORK_TYPE_DICTION[chainId]; | |
| const ethName = ETH_TYPE_DICTION[chainId]; | |
| return polkadotName || ethName || `Chain ID ${chainId}`; | |
| }, [project.type, project.manifest]); |
🤖 Prompt for AI Agents
In `@src/components/ProjectCard/ProjectCard.tsx` around lines 54 - 69, In
ProjectCard's networkVal useMemo the RPC branch returns
project.manifest.rpcFamily[0] without checking length, which yields undefined
for an empty array; update the RPC branch in networkVal (used in ProjectCard
when project.type === ProjectType.RPC) to check that
project.manifest?.rpcFamily?.length > 0 and return the first element only then,
otherwise fall back to '-' (or the existing downstream fallback), ensuring
project.manifest.rpcFamily is safely handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/ProjectHeader/ProjectHeader.tsx (1)
99-101:⚠️ Potential issue | 🟡 MinorSame edge case: empty
rpcFamilyarray returnsundefined.Same issue as in ProjectCard - if
manifest?.rpcFamilyis[], the condition passes butrpcFamily[0]isundefined.Suggested fix
const networkVal = React.useMemo(() => { - if (project.type === ProjectType.RPC && manifest?.rpcFamily) { + if (project.type === ProjectType.RPC && manifest?.rpcFamily?.length) { return manifest?.rpcFamily[0]; }
🤖 Fix all issues with AI agents
In `@src/const/const.ts`:
- Line 1003: ETH_TYPE_DICTION contains an inconsistent duplicate key "gnosis"
(string name) while the rest use numeric chain ID strings (e.g., "100":
"Gnosis"); remove the erroneous "gnosis": "Gnosis" entry from ETH_TYPE_DICTION
(or if intended, replace the key with "100") so lookups using the numeric chain
ID match the correct value.
🧹 Nitpick comments (1)
src/components/ProjectHeader/ProjectHeader.tsx (1)
107-113: Consider consistent fallback format with ProjectCard.ProjectHeader falls back to the raw
chainId, while ProjectCard usesChain ID ${chainId}. This creates inconsistent display behavior for unmapped chains across the UI.Optional: Align with ProjectCard's fallback format
return ( getNetworkNameByChainId(chainId, { projectName: project.metadata?.name, projectId: project.id, source: 'ProjectHeader', - }) || chainId + }) || `Chain ID ${chainId}` );Note: If the raw chainId display is intentional due to space constraints in the header UI, this can be ignored.
| '11155111': 'Ethereum Sepolia', | ||
| '65000000': 'Autonity Mainnet', | ||
| '10200': 'Gnosis Chiado Testnet', | ||
| gnosis: 'Gnosis', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent key format: gnosis is not a numeric chain ID.
All other entries in ETH_TYPE_DICTION use numeric chain IDs as string keys (e.g., '100' for Gnosis). The key gnosis won't match lookups using the actual chain ID '100'. This appears to be a duplicate or erroneous entry since '100': 'Gnosis' already exists at line 119.
Suggested fix: remove duplicate entry
'10200': 'Gnosis Chiado Testnet',
- gnosis: 'Gnosis',
};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| gnosis: 'Gnosis', | |
| '10200': 'Gnosis Chiado Testnet', | |
| }; |
🤖 Prompt for AI Agents
In `@src/const/const.ts` at line 1003, ETH_TYPE_DICTION contains an inconsistent
duplicate key "gnosis" (string name) while the rest use numeric chain ID strings
(e.g., "100": "Gnosis"); remove the erroneous "gnosis": "Gnosis" entry from
ETH_TYPE_DICTION (or if intended, replace the key with "100") so lookups using
the numeric chain ID match the correct value.
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Ticket: #ticket number
Test cases:
Please describe tested cases.
Type of change
Please delete options that are not relevant.
UI Changes
Add before and after changes for UI if needed.
Summary by CodeRabbit
New Features
Bug Fixes
Chores