feat(react): add custom queryKey and mutation option overrides (Close… - #152
Merged
Cjay-Cyber-2 merged 2 commits intoSep 1, 2026
Merged
Conversation
…ASTROIDX556#26) Updates hooks in packages/react/src/hooks/ and packages/react/src/index.ts to expose full TanStack Query option overrides with generics. - ReadOptions<TData, TError> = Omit<UseQueryOptions<TData,...>, 'queryKey'|'queryFn'> & { queryKey?: readonly unknown[] } exposes queryKey, staleTime, refetchInterval, gcTime, select, enabled etc. with TSDoc - WriteOptions<TData, TVars> = Omit<UseMutationOptions, 'mutationFn'> exposes mutationKey, onSuccess/onError/onSettled, retry etc. - every read hook (useWallets, useWallet, useAgents, useAgent, usePolicies, useBudgets, useTransactions, useNotifications, useUnreadCount, useAnalyticsOverview) now destructures { queryKey, ...rest }, defaults to queryKeys.* when not overridden, and correctly merges enabled with Boolean(id) guard for detail hooks; staleTime/refetchInterval/gcTime are forwarded via rest as Omit<UseQueryOptions, 'queryKey'|'queryFn'> - every mutation hook (useCreateWallet, useTransfer, useCreateAgent, useRequestPayment) now destructures onSuccess/onError/onSettled and composes them with automatic invalidation (qc.invalidateQueries), preserving user callbacks and mutationKey/retry overrides - generics: ReadOptions/WriteOptions forward TData/TError/TVars/TContext to TanStack interfaces; existing signatures remain fully compatible (options is optional, defaults functional) - hooks mirrored in packages/react/src/hooks/ (index.ts barrel + per-hook files) for layout compliance; index re-exports ReadOptions/WriteOptions - vitest: switched to jsdom, includes __tests__, added @testing-library/react + jsdom + @testing-library/jest-dom deps in package.json - tests: 10 tests in packages/react/__tests__/hooks.test.tsx using @testing-library/react renderHook with QueryClientProvider/AstroidProvider verify custom queryKey isolation, staleTime/refetchInterval forwarding, custom onSuccess/onError composition, and zero regressions for default behavior Closes ASTROIDX556#26
|
@pixels26 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
MergeKeeper review Scope: in scope for linked issue The pull request successfully implements custom query keys and mutation option overrides for the @astroid/react hooks along with proper testing and TypeScript support. Reviewed commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…s #26)
Updates hooks in packages/react/src/hooks/ and packages/react/src/index.ts to expose full TanStack Query option overrides with generics.
Closes #26
Summary
Type of change
Related issue
Closes #
Checklist
npm run buildpassesnpm run typecheckpassesnpm run lintpasses