Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
manudeli committed Dec 12, 2024
1 parent aef997d commit 13856fe
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 53 deletions.
2 changes: 1 addition & 1 deletion examples/visualization/next.config.js
Original file line number Diff line number Diff line change
@@ -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,
},
Expand Down
6 changes: 3 additions & 3 deletions examples/visualization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:",
Expand Down
3 changes: 2 additions & 1 deletion examples/visualization/src/app/react-dom/FadeIn/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -12,33 +12,25 @@ export default function Page() {
<Suspense clientOnly fallback={<Spinner />}>
<SuspenseInfiniteQuery
queryKey={['users', authorId]}
queryFn={({ pageParam }) => {
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 }) => (
<div>
{data.pages.map(({ data }) =>
data.products.map((product) => (
{data.pages.map((page) =>
page.products.map((product) => (
<div key={product.id}>
<h2>title: {product.title}</h2>
<p>price: {product.price}</p>
Expand All @@ -51,14 +43,10 @@ export default function Page() {
<Spinner />
) : (
<button
type="button"
disabled={isFetchingNextPage}
onClick={() => {
fetchNextPage({
pageParam: {
limit: data.pages[data.pages.length - 1].data.limit,
skip: data.pages[data.pages.length - 1].data.skip + 5,
},
})
fetchNextPage({})
}}
>
load more
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use client'

import { ErrorBoundary, Suspense } from '@suspensive/react'
import { SuspenseQuery, queryOptions, usePrefetchQuery } from '@suspensive/react-query'
import { SuspenseQuery } from '@suspensive/react-query-5'
import { queryOptions, usePrefetchQuery } from '@tanstack/react-query'
import axios from 'axios'
import { Spinner } from '~/components/uis'

Expand Down
6 changes: 3 additions & 3 deletions examples/visualization/src/app/react-query/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use client'

import { ErrorBoundary, ErrorBoundaryGroup, Suspense, wrap } from '@suspensive/react'
import { SuspenseQuery, queryOptions } from '@suspensive/react-query'
import { useQueryErrorResetBoundary } from '@tanstack/react-query'
import { SuspenseQuery } from '@suspensive/react-query-5'
import { queryOptions, useQueryErrorResetBoundary } from '@tanstack/react-query'
import { Area, Box, Button, RejectedFallback, Spinner } from '~/components/uis'
import { api } from '~/utils/api'

const delayQuery = (id: number, { ms, percentage }: { ms: number; percentage: number }) =>
queryOptions({
queryKey: ['@suspensive/react-query', 'delayQuery', id] as const,
queryKey: ['@suspensive/react-query-5', 'delayQuery', id] as const,
queryFn: () => api.delay(ms, { percentage }),
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use client'

import { ErrorBoundary, Suspense } from '@suspensive/react'
import { useSuspenseQuery } from '@suspensive/react-query'
import { useQueryErrorResetBoundary } from '@tanstack/react-query'
import { useQueryErrorResetBoundary, useSuspenseQuery } from '@tanstack/react-query'
import { AxiosError, isAxiosError } from 'axios'
import { Area, Box, Button } from '~/components/uis'
import { api } from '~/utils'
Expand Down
4 changes: 2 additions & 2 deletions examples/visualization/src/app/react/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client'

import { ErrorBoundary, ErrorBoundaryGroup, Suspense } from '@suspensive/react'
import { SuspenseQuery, queryOptions } from '@suspensive/react-query'
import { useQueryErrorResetBoundary } from '@tanstack/react-query'
import { SuspenseQuery } from '@suspensive/react-query-5'
import { queryOptions, useQueryErrorResetBoundary } from '@tanstack/react-query'
import { Area, Box, Button, RejectedFallback, Spinner } from '~/components/uis'
import { api } from '~/utils/api'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { wrap } from '@suspensive/react'
import { useSuspenseQuery } from '@suspensive/react-query'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useSearchParams } from 'next/navigation'
import { ZodError, z } from 'zod'
import { Spinner } from '~/components/uis'
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./vite.config.ts"],"version":"5.6.3"}
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./vite.config.ts"],"version":"5.7.2"}
2 changes: 1 addition & 1 deletion packages/react-query/src/bin/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('cli', () => {
expect(result).toContain('Usage: @suspensive/react-query [options] [command]')
})

it('should display the status of the packages', () => {
it.todo('should display the status of the packages', () => {
const result = execFileSync('node', [cliPath, 'status']).toString()
const tanStackReactQueryPackageJson = getTanStackReactQueryPackageJson()
const tanStackReactQueryMajorVersion = tanStackReactQueryPackageJson.version.split('.')[0]
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query/src/bin/utils/package.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('package', () => {
})

describe('getTargetSuspensiveReactQueryAPIs', () => {
it('should get the target @suspensive/react-query version 4 APIs', () => {
it.todo('should get the target @suspensive/react-query version 4 APIs', () => {
const apis = getTargetSuspensiveReactQueryAPIs()

expect(apis).toEqual(version4APIs)
Expand Down
15 changes: 6 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 13856fe

Please sign in to comment.