Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
React Doctor found 3 new issues in 1 file · 3 warnings · score 82 / 100 (Needs work) · 0 fixed · vs 3 warnings
Reviewed by React Doctor for commit |
| compact: { nonce: string; sponsor: string }; | ||
| }; | ||
|
|
||
| export function ManualRefund() { |
There was a problem hiding this comment.
React Doctor · react-doctor/no-high-complexity-react-function (warning)
ManualRefund has cyclomatic complexity 16, cognitive complexity 33, and maximum nesting depth 6, so its React logic is hard to understand and change. Extract independent branches into components or hooks.
Fix → Extract independent render branches and state logic into focused components or hooks until the control flow is easy to follow.
| const selected = intents.data?.find( | ||
| (intent) => `${intent.chainId}:${intent.hash}` === selection, | ||
| ); | ||
| const refund = useMutation({ |
There was a problem hiding this comment.
React Doctor · react-doctor/query-mutation-missing-invalidation (warning)
useMutation with no cache update here can leave your users looking at stale data after it runs.
Fix → Add onSuccess: () => queryClient.invalidateQueries({ queryKey: ['...'] }) so cached data stays in sync after the mutation
| `Switch your wallet to ${getTestnetChainName(chainId)}.`, | ||
| ); | ||
| } | ||
| const response = await fetch(`${allocator}/manual-refund-calldata`, { |
There was a problem hiding this comment.
React Doctor · react-doctor/no-fetch-response-used-without-status-check (warning)
fetch() resolves (does not reject) on HTTP 4xx/5xx, so this unchecked body read may treat an HTTP error payload like a successful response. Check response.ok/response.status, or deliberately handle the API's error payload, before reading the body.
Fix → Check response.ok (or response.status) before consuming a fetch Response with .json()/.text()/.blob(). fetch resolves on HTTP 4xx/5xx, so an unchecked response parses the error body as success or crashes on an always-truthy guard.
Summary
Requires the manual refund endpoint from epochprotocol/smallocator#87.
Verification
npm test(6 passed)npm run typecheck