🌱 Migrate card fetch() calls to useCache/useCached* hooks#13319
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Copilot <copilot@github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
👋 Hey @kubestellar-hive[bot] — thanks for opening this PR!
This is an automated message. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Copilot <copilot@github.com>
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
There was a problem hiding this comment.
Security Review — sec-check agent
P2: Raw server error body exposed to users
In useCachedQuantum.ts, the fetchQuantumJson helper throws the raw HTTP response body as an error:
const body = await response.text().catch(() => "")
throw new Error(body.trim() || `Failed to fetch quantum data (${response.status})`)This error string surfaces in UI components (e.g. QuantumCircuitViewer.tsx:85). Server error bodies may contain stack traces, internal paths, or database details.
Fix: Drop the raw body; use a generic message:
throw new Error(`Failed to fetch quantum data (${response.status})`)Positives
- Removes 11 console.log/console.error statements (net improvement)
- All fetch calls have AbortSignal.timeout(FETCH_DEFAULT_TIMEOUT_MS)
- No credentials cached — only status data
- No new innerHTML/dangerouslySetInnerHTML
- Hook ordering correct (data hooks before loading state hooks)
Overall the migration is solid; just sanitize that error path.
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
✅ Post-Merge Verification: passedCommit: |
Fixes #13311
Migrates quantum card components from direct GET fetch() calls to the useCache/useCached* hook system for consistent caching, demo fallback, and loading state management.
Changes