Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[frontend] upgrade to react-query v5 #14346

Merged
merged 24 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/main' into wrobertson/v5_query
  • Loading branch information
williamrobertson13 committed Oct 24, 2023
commit db962740f658559d2688b031ed5690c56a567f6e
8 changes: 6 additions & 2 deletions sdk/dapp-kit/src/hooks/useSuiClientInfiniteQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ export function useSuiClientInfiniteQuery<
initialPageParam: null,
queryKey: [suiContext.network, method, params, ...queryKey],
enabled,
queryFn: () => suiContext.client[method](params as never),
getNextPageParam: ({ hasNextPage, nextCursor }) => (hasNextPage ? nextCursor : null),
queryFn: ({ pageParam }) =>
suiContext.client[method]({
...(params ?? {}),
cursor: pageParam,
} as never),
getNextPageParam: ({ nextCursor }) => nextCursor ?? null,
});
}
7 changes: 3 additions & 4 deletions sdk/docs/pages/dapp-kit/rpc-hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ details on the full set of options available.
import { useSuiClientQuery } from '@mysten/dapp-kit';

function MyComponent() {
const { data, isPending, error, refetch } = useSuiClientQuery(
const { data, isPending, isError, error, refetch } = useSuiClientQuery(
'getOwnedObjects',
{ owner: '0x123' },
{
Expand Down Expand Up @@ -48,9 +48,8 @@ For more details checkout out the
import { useSuiClientInfiniteQuery } from '@mysten/dapp-kit';

function MyComponent() {
const { data, isPending, isFetching, fetchNextPage, hasNextPage } = useSuiClientInfiniteQuery(
'getOwnedObjects',
{
const { data, isPending, isError, error, isFetching, fetchNextPage, hasNextPage } =
useSuiClientInfiniteQuery('getOwnedObjects', {
owner: '0x123',
});

Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.