[Query] Type queryFn return instead of useQuery generic#2128
[Query] Type queryFn return instead of useQuery generic#2128jeesunikim wants to merge 7 commits into
Conversation
Move the result type from the useQuery<T> generic onto each queryFn return annotation so TData is inferred from the function. Widen useSEContractInfo's consumer prop to accept the now-accurate null. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR shifts TanStack Query result typing from useQuery<T>() generics to explicit queryFn return annotations so TQueryFnData/TData are inferred from the function, and updates a smart-contract explorer consumer to accept null where the StellarExpert contract info query can legitimately return it.
Changes:
- Removed
useQuery<T>()generics across several query hooks and added explicitqueryFnPromise<...>return annotations. - Updated StellarExpert/RPC query hooks to surface more accurate
nullpossibilities via inference. - Widened
ContractInfo’sinfoDataprop type to acceptnullin addition toundefined.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/query/useWasmGitHubAttestation.ts | Moves useQuery result typing onto the queryFn return annotation. |
| src/query/useWasmBinaryFromRpc.ts | Moves useQuery result typing onto the queryFn return annotation. |
| src/query/useMaintenanceData.ts | Moves useQuery result typing onto the queryFn return annotation. |
| src/query/useGitHubReadmeText.ts | Moves useQuery result typing onto the queryFn return annotation. |
| src/query/useGitHubFile.ts | Moves useQuery result typing onto the queryFn return annotation. |
| src/query/useGetContractDataFromRpcById.ts | Moves a complex useQuery result type onto the queryFn return annotation. |
| src/query/useContractClientFromRpc.ts | Moves useQuery result typing onto the queryFn return annotation. |
| src/query/external/useSEContractWasmBinary.ts | Moves useQuery result typing onto the queryFn return annotation. |
| src/query/external/useSEContractVersionHistory.ts | Moves useQuery result typing onto the queryFn return annotation (including null). |
| src/query/external/useSEContractStorage.ts | Moves useQuery result typing onto the queryFn return annotation (including null). |
| src/query/external/useSEContractsList.ts | Moves useQuery result typing onto the queryFn return annotation. |
| src/query/external/useSEContractInfo.ts | Moves useQuery result typing onto the queryFn return annotation (now accurately includes null). |
| src/app/(sidebar)/smart-contracts/contract-explorer/components/ContractInfo.tsx | Updates infoData prop type to accept null from the refined query typing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Preview is available here: |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Preview is available here: |
1 similar comment
|
Preview is available here: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b8f9c5412
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Preview is available here: |
2 similar comments
|
Preview is available here: |
|
Preview is available here: |
Coercing a missing/non-array scheduled_maintenances to [] made a broken API response indistinguishable from a valid empty schedule, silently hiding the testnet reset-date warning. Throw instead so the failure surfaces in the banner's error branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Preview is available here: |
See the official doc: