Skip to content

Commit

Permalink
ref: Migrate useRepos to TS Query V5 (#3617)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov authored Jan 6, 2025
1 parent d88bff4 commit 82938e3
Show file tree
Hide file tree
Showing 19 changed files with 320 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
useQueryClient,
} from '@tanstack/react-query'
import {
useSuspenseQuery as useSuspenseQueryV5,
useInfiniteQuery as useInfiniteQueryV5,
useQueryClient as useQueryClientV5,
useSuspenseQuery as useSuspenseQueryV5,
} from '@tanstack/react-queryV5'
import {
createColumnHelper,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AnalyticsPage/AnalyticsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useParams } from 'react-router-dom'

import NotFound from 'pages/NotFound'
import { useLocationParams } from 'services/navigation'
import { orderingOptions } from 'services/repos'
import { orderingOptions } from 'services/repos/orderingOptions'
import { useOwner } from 'services/user'
import ReposTable from 'shared/ListRepo/ReposTable'

Expand Down
24 changes: 13 additions & 11 deletions src/pages/AnalyticsPage/ChartSelectors/ChartSelectors.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useInfiniteQuery as useInfiniteQueryV5 } from '@tanstack/react-queryV5'
import PropTypes from 'prop-types'
import { useMemo, useRef, useState } from 'react'
import { useParams } from 'react-router-dom'

import { useRepos } from 'services/repos'
import { ReposQueryOpts } from 'services/repos/ReposQueryOpts'
import { TierNames, useTier } from 'services/tier'
import A from 'ui/A'
import DateRangePicker from 'ui/DateRangePicker'
Expand Down Expand Up @@ -60,16 +61,17 @@ function RepoSelector({
isLoading,
fetchNextPage,
hasNextPage,
} = useRepos({
provider,
owner,
sortItem,
activated: active,
term: search,
first: Infinity,
suspense: false,
isPublic: shouldDisplayPublicReposOnly,
})
} = useInfiniteQueryV5(
ReposQueryOpts({
provider,
owner,
sortItem,
activated: active,
term: search,
first: Infinity,
isPublic: shouldDisplayPublicReposOnly,
})
)

const reposSelectData = useMemo(() => {
const data = reposData?.pages?.map((page) => page?.repos).flat()
Expand Down
Loading

0 comments on commit 82938e3

Please sign in to comment.