diff --git a/src/pages/CommitDetailPage/Header/HeaderTeam/HeaderTeam.jsx b/src/pages/CommitDetailPage/Header/HeaderTeam/HeaderTeam.jsx index 9c60db9d84..e997dd988f 100644 --- a/src/pages/CommitDetailPage/Header/HeaderTeam/HeaderTeam.jsx +++ b/src/pages/CommitDetailPage/Header/HeaderTeam/HeaderTeam.jsx @@ -1,3 +1,4 @@ +import { useSuspenseQuery as useSuspenseQueryV5 } from '@tanstack/react-queryV5' import { useParams } from 'react-router-dom' import { formatTimeToNow } from 'shared/utils/dates' @@ -8,7 +9,7 @@ import Icon from 'ui/Icon' import TotalsNumber from 'ui/TotalsNumber' import TruncatedMessage from 'ui/TruncatedMessage/TruncatedMessage' -import { useCommitHeaderDataTeam } from './hooks' +import { CommitHeaderDataTeamQueryOpts } from './queries/CommitHeaderDataTeamQueryOpts' import PullLabel from '../PullLabel' @@ -16,12 +17,14 @@ function HeaderTeam() { const { provider, owner, repo, commit: commitSha } = useParams() const shortSHA = commitSha?.slice(0, 7) - const { data: headerData } = useCommitHeaderDataTeam({ - provider, - owner, - repo, - commitId: commitSha, - }) + const { data: headerData } = useSuspenseQueryV5( + CommitHeaderDataTeamQueryOpts({ + provider, + owner, + repo, + commitId: commitSha, + }) + ) const commit = headerData?.commit const providerPullUrl = getProviderPullURL({ diff --git a/src/pages/CommitDetailPage/Header/HeaderTeam/HeaderTeam.test.jsx b/src/pages/CommitDetailPage/Header/HeaderTeam/HeaderTeam.test.jsx index 25879ab289..d638526e7d 100644 --- a/src/pages/CommitDetailPage/Header/HeaderTeam/HeaderTeam.test.jsx +++ b/src/pages/CommitDetailPage/Header/HeaderTeam/HeaderTeam.test.jsx @@ -1,7 +1,12 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query' +import { + QueryClientProvider as QueryClientProviderV5, + QueryClient as QueryClientV5, +} from '@tanstack/react-queryV5' import { render, screen, waitFor } from '@testing-library/react' import { graphql, HttpResponse } from 'msw' import { setupServer } from 'msw/node' +import { Suspense } from 'react' import { MemoryRouter, Route } from 'react-router-dom' import HeaderTeam from './HeaderTeam' @@ -43,25 +48,39 @@ const mockData = (pullId = null) => ({ }, }) +const server = setupServer() const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } }, }) -const server = setupServer() +const queryClientV5 = new QueryClientV5({ + defaultOptions: { queries: { retry: false } }, +}) const wrapper = ({ children }) => ( - - - {children} - - + + + + + Loading}>{children} + + + + ) -beforeAll(() => server.listen()) +beforeAll(() => { + server.listen() +}) + afterEach(() => { queryClient.clear() + queryClientV5.clear() server.resetHandlers() }) -afterAll(() => server.close()) + +afterAll(() => { + server.close() +}) describe('HeaderTeam', () => { function setup(pullId = 1234) {