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

fix(deps): update dependency @tanstack/react-query to v5 #1227

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"validate": "run-p lint test:ci test:e2e:headless"
},
"dependencies": {
"@tanstack/react-query": "4.36.1",
"@tanstack/react-query": "5.17.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-router-dom": "6.16.0"
Expand Down
45 changes: 10 additions & 35 deletions pnpm-lock.yaml

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

9 changes: 6 additions & 3 deletions src/pages/Details.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useQuery } from '@tanstack/react-query'
import getFruits from 'api/getFruits'
import Head from 'components/Head'
import ImageAttribution from 'components/ImageAttribution'
import LoadingOrError from 'components/LoadingOrError'
import type { ReactElement } from 'react'
import { useQuery } from '@tanstack/react-query'
import { Link, Navigate, useParams } from 'react-router-dom'
import { useMediaQuery } from 'utils'

Expand All @@ -14,8 +14,11 @@ export default function DetailsPage(): ReactElement {
const isTabletAndUp = useMediaQuery('(min-width: 600px)')
const { fruitName } = useParams()

const { isLoading, isError, error, data } = useQuery(['fruits'], getFruits)
if (isLoading || isError) {
const { isPending, isError, error, data } = useQuery({
queryKey: ['fruits'],
queryFn: getFruits
})
if (isPending || isError) {
return <LoadingOrError error={error as Error} />
}

Expand Down
9 changes: 6 additions & 3 deletions src/pages/Gallery.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { useQuery } from '@tanstack/react-query'
import getFruits from 'api/getFruits'
import Fruit from 'components/Fruit'
import Head from 'components/Head'
import LoadingOrError from 'components/LoadingOrError'
import type { ReactElement } from 'react'
import { useQuery } from '@tanstack/react-query'

export default function GalleryPage(): ReactElement {
const { isLoading, isError, error, data } = useQuery(['fruits'], getFruits)
if (isLoading || isError) {
const { isPending, isError, error, data } = useQuery({
queryKey: ['fruits'],
queryFn: getFruits
})
if (isPending || isError) {
return <LoadingOrError error={error as Error} />
}

Expand Down
2 changes: 1 addition & 1 deletion src/testUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
cacheTime: 0
gcTime: 0
}
}
})
Expand Down