You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: usePortfolio hook uses relative API paths and bypasses retry/timeout logic #66
In frontend/src/hooks/usePortfolio.ts, both fetchPortfolio and executeRebalance call fetch() directly with relative paths like /api/portfolio/${portfolioId}. This bypasses:
The centralized API_CONFIG.BASE_URL from frontend/src/config/api.ts — needed for non-same-origin deployments (e.g., the production Render URL)
The apiRequest wrapper's retry logic (3 attempts with exponential backoff)
The 15-second timeout via AbortController
In production, if the API is on a different origin, the hook's calls silently fail or hit the wrong endpoint. This was partially addressed in issue #47 but the hook was not updated — only Dashboard.tsx and Landing.tsx use API_CONFIG.BASE_URL.
Proposed Fix
1. Use API_CONFIG.BASE_URL
Import API_CONFIG from ../config/api and prefix all fetch URLs:
apiRequest returns parsed JSON. The GET /portfolio/:id route returns { success: true, portfolio: {...} }, so make sure setPortfolio(data.portfolio) still works correctly.
Files to modify
frontend/src/hooks/usePortfolio.ts — update fetchPortfolio and executeRebalance
Acceptance Criteria
Import API_CONFIG from ../config/api
All fetch URLs prefixed with API_CONFIG.BASE_URL
Replace direct fetch() with apiRequest wrapper
setPortfolio(data.portfolio) still works correctly with parsed JSON response
Hook works when VITE_API_URL is set to a remote URL
Network errors show error state and retry per apiRequest config
I’m currently a Computer Science student and I’m starting to get into the world of open source contributions. I’m very interested in this issue and would like to work on it to gain experience, build confidence, and expand my CV.
Good day maintainer, i would like to work on this issue. i will update usePortfolio to use API_CONFIG.BASE_URL and the apiRequest wrapper for consistent retries, timeouts, error handling, and remote API support.
I would like to work on this issue. I’ve gone through the project and carefully reviewed the issue itself, and I believe it’s something I can handle effectively. I’m confident in my ability to work on it, give it my best, and get it completed successfully. I’m ready to take on the task and deliver a solid result.
Activity
waterWang commentedon Aug 22, 2026
I would like to work on this issue. Please assign it to me.
Neziahtech commentedon Aug 22, 2026
Hello,
I’d love to take this issue on. I’m a full-stack developer with experience across Drips Waves 3–7, and the GrantFox oficiall 1 and2 campaign.
My stack includes Rust, Soroban, Solidity, and TypeScript. I can deliver a clean, tested, and well-documented solution within 24 hours of assignment.
Happy to start immediately.
waterWang commentedon Aug 22, 2026
Submitted PR #69 for this issue: #69
Changes:
fetch()calls withapiRequestwrapperAPI_CONFIG.ENDPOINTS.PORTFOLIO_DETAILandENDPOINTS.PORTFOLIO_REBALANCEapiRequestprovides retry logic, timeout, andBASE_URLprefixingD240021 commentedon Aug 22, 2026
Hi! 👋
I’m currently a Computer Science student and I’m starting to get into the world of open source contributions. I’m very interested in this issue and would like to work on it to gain experience, build confidence, and expand my CV.
Could you please assign it to me? 🙂
Thank you! 🚀
waterWang commentedon Aug 23, 2026
I would like to work on this issue. Fixing usePortfolio to use centralized API config and retry/timeout logic.
Stanley-Owoh commentedon Aug 23, 2026
Good day maintainer, i would like to work on this issue. i will update
usePortfolioto useAPI_CONFIG.BASE_URLand theapiRequestwrapper for consistent retries, timeouts, error handling, and remote API support.TCROWN10 commentedon Aug 23, 2026
I would like to work on this issue. I’ve gone through the project and carefully reviewed the issue itself, and I believe it’s something I can handle effectively. I’m confident in my ability to work on it, give it my best, and get it completed successfully. I’m ready to take on the task and deliver a solid result.
grantfox-oss commentedon Aug 24, 2026
🦊 GrantFox — @TCROWN10 has been assigned to this issue as part of the Third Campaign campaign!
Next steps:
Closes #66)Good luck! Track your progress on GrantFox.
fix: route usePortfolio through apiRequest and API_CONFIG (#73)
grantfox-oss commentedon Aug 26, 2026
🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!
@TCROWN10's PR #73 was approved and merged by @Uchechukwu-Ekezie.
🏆 @TCROWN10: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (379 total points). Track your full progress on GrantFox.
👏 Great work, @TCROWN10! Keep contributing to grantFoxin.