From 13856fe49bb6bcb74776ba92ed5535e92fc5c67a Mon Sep 17 00:00:00 2001 From: Jonghyeon Ko Date: Fri, 13 Dec 2024 00:54:26 +0900 Subject: [PATCH] chore: update --- examples/visualization/next.config.js | 2 +- examples/visualization/package.json | 6 +-- .../src/app/react-dom/FadeIn/page.tsx | 3 +- .../SuspenseInfiniteQuery/page.tsx | 42 +++++++------------ .../app/react-query/SuspenseQuery/page.tsx | 3 +- .../src/app/react-query/page.tsx | 6 +-- .../react/ErrorBoundary/shouldCatch/page.tsx | 3 +- examples/visualization/src/app/react/page.tsx | 4 +- .../src/app/react/zodSearchParams/page.tsx | 2 +- .../tsconfig.tsbuildinfo | 2 +- packages/react-query/src/bin/cli.spec.ts | 2 +- .../react-query/src/bin/utils/package.spec.ts | 2 +- pnpm-lock.yaml | 15 +++---- 13 files changed, 39 insertions(+), 53 deletions(-) diff --git a/examples/visualization/next.config.js b/examples/visualization/next.config.js index 370013118..8613db64c 100644 --- a/examples/visualization/next.config.js +++ b/examples/visualization/next.config.js @@ -1,7 +1,7 @@ /** @type {import('next').NextConfig} */ module.exports = { reactStrictMode: true, - transpilePackages: ['@suspensive/react', '@suspensive/react-query'], + transpilePackages: ['@suspensive/react', '@suspensive/react-query-5'], experimental: { typedRoutes: true, }, diff --git a/examples/visualization/package.json b/examples/visualization/package.json index 3d0cada32..313b3a8de 100644 --- a/examples/visualization/package.json +++ b/examples/visualization/package.json @@ -14,9 +14,9 @@ "dependencies": { "@suspensive/react": "workspace:*", "@suspensive/react-dom": "workspace:*", - "@suspensive/react-query": "workspace:*", - "@tanstack/react-query": "catalog:react-query4", - "@tanstack/react-query-devtools": "catalog:react-query4", + "@suspensive/react-query-5": "workspace:*", + "@tanstack/react-query": "catalog:react-query5", + "@tanstack/react-query-devtools": "catalog:react-query5", "axios": "^1.7.9", "clsx": "catalog:", "next": "catalog:", diff --git a/examples/visualization/src/app/react-dom/FadeIn/page.tsx b/examples/visualization/src/app/react-dom/FadeIn/page.tsx index 833169b75..2b49ac863 100644 --- a/examples/visualization/src/app/react-dom/FadeIn/page.tsx +++ b/examples/visualization/src/app/react-dom/FadeIn/page.tsx @@ -2,7 +2,8 @@ import { ErrorBoundary, Suspense } from '@suspensive/react' import { FadeIn } from '@suspensive/react-dom' -import { SuspenseQuery, queryOptions } from '@suspensive/react-query' +import { SuspenseQuery } from '@suspensive/react-query-5' +import { queryOptions } from '@tanstack/react-query' import axios from 'axios' import { delay } from '~/utils' diff --git a/examples/visualization/src/app/react-query/SuspenseInfiniteQuery/page.tsx b/examples/visualization/src/app/react-query/SuspenseInfiniteQuery/page.tsx index 5609e6aae..51962993a 100644 --- a/examples/visualization/src/app/react-query/SuspenseInfiniteQuery/page.tsx +++ b/examples/visualization/src/app/react-query/SuspenseInfiniteQuery/page.tsx @@ -1,7 +1,7 @@ 'use client' import { ErrorBoundary, Suspense } from '@suspensive/react' -import { SuspenseInfiniteQuery } from '@suspensive/react-query' +import { SuspenseInfiniteQuery } from '@suspensive/react-query-5' import axios from 'axios' import { Spinner } from '~/components/uis' @@ -12,33 +12,25 @@ export default function Page() { }> { - const { limit, skip } = (pageParam ?? { limit: 5, skip: undefined }) as { limit: number; skip?: number } - return axios + queryFn={({ pageParam }) => + axios .get<{ limit: number skip: number total: number - products: Array<{ - id: number - title: string - price: number - }> - }>(`https://dummyjson.com/products?limit=${limit}${skip ? `&skip=${skip}` : ''}&select=title,price`) - .then(({ data }) => ({ - data, - pageParam: { - limit: data.limit, - skip: data.limit, - }, - })) - }} - getNextPageParam={(lastPage) => lastPage.pageParam} + products: Array<{ id: number; title: string; price: number }> + }>( + `https://dummyjson.com/products?limit=${pageParam.limit}${pageParam.skip ? `&skip=${pageParam.skip}` : ''}&select=title,price` + ) + .then(({ data }) => data) + } + initialPageParam={{ limit: 5, skip: undefined } as { limit: number; skip: number | undefined }} + getNextPageParam={(lastPage) => ({ limit: 5, skip: lastPage.skip + 5 })} > {({ data, fetchNextPage, hasNextPage, isFetchingNextPage }) => (
- {data.pages.map(({ data }) => - data.products.map((product) => ( + {data.pages.map((page) => + page.products.map((product) => (

title: {product.title}

price: {product.price}

@@ -51,14 +43,10 @@ export default function Page() { ) : (