Skip to content

Refactor agent detail fetches onto useApi#209

Merged
mikewheeleer merged 1 commit into
Agentpay-Org:mainfrom
niufuti-cyber:refactor/agents-detail-useapi
Jun 29, 2026
Merged

Refactor agent detail fetches onto useApi#209
mikewheeleer merged 1 commit into
Agentpay-Org:mainfrom
niufuti-cyber:refactor/agents-detail-useapi

Conversation

@niufuti-cyber

Copy link
Copy Markdown
Contributor

Summary

  • Migrates the agent detail page's primary usage request to the shared useApi hook, keyed by the URL-encoded agent id so navigation aborts superseded usage requests.
  • Keeps the optional lifetime-total request as a soft failure while guarding it so stale responses from a previous agent cannot overwrite the current view.
  • Adds focused tests for success, usage errors, optional-total failure, rapid agent switching, unmount cancellation, and the updated shared-hook abort behavior.
  • Documents the agent detail cancellation/stale-response behavior in the README.

Addresses #178

Verification

  • npm run lint: passes with 0 errors and 3 pre-existing warnings in src/components/__tests__/ConfirmDialog.test.tsx
  • npm run typecheck: passes
  • npm test -- --runInBand --runTestsByPath src/app/agents/[agent]/page.test.tsx src/app/changelog/page.test.tsx: 2 suites passed, 10 tests passed

Notes

I am not claiming the full suite or build are currently green:

  • Full npm test -- --runInBand was checked against the same base and has unrelated baseline failures in src/app/usage/page.test.tsx and src/components/__tests__/ConfirmDialog.test.tsx.
  • npm run build was checked against the same base in a no-network verification environment and fails before this patch because the app imports Google fonts through next/font/google.

@mikewheeleer

Copy link
Copy Markdown
Contributor

thanks for the effort @niufuti-cyber! 🙏 i can't tie this to an issue assigned to you, and we merge from the assigned contributor to keep the campaign fair. please claim an open unassigned issue first, then open your PR. closing for now — hope to see it back 🙌

@mikewheeleer

Copy link
Copy Markdown
Contributor

great stuff — thanks for this!

@mikewheeleer mikewheeleer merged commit 4eed194 into Agentpay-Org:main Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants