Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,12 @@ const BundleContent: React.FC<BundleContentProps> = ({
const PullBundleAnalysis: React.FC = () => {
const { provider, owner, repo, pullId } = useParams<URLParams>()

// we can set team plan true here because we don't care about the fields it will skip - tho we should really stop doing this and just return null on the API if they're on a team plan so we can save on requests made
const { data } = useSuspenseQueryV5(
PullPageDataQueryOpts({
provider,
owner,
repo,
pullId,
isTeamPlan: true,
})
)

Expand Down
9 changes: 1 addition & 8 deletions src/pages/PullRequestPage/PullCoverage/PullCoverage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { Redirect, Switch, useParams } from 'react-router-dom'
import { SentryRoute } from 'sentry'

import SilentNetworkErrorWrapper from 'layouts/shared/SilentNetworkErrorWrapper'
import { useRepoOverview, useRepoRateLimitStatus } from 'services/repo'
import { useIsTeamPlan } from 'services/useIsTeamPlan'
import { useRepoRateLimitStatus } from 'services/repo'
import ComparisonErrorBanner from 'shared/ComparisonErrorBanner'
import GitHubRateLimitExceededBanner from 'shared/GlobalBanners/GitHubRateLimitExceeded/GitHubRateLimitExceededBanner'
import { ComparisonReturnType, ReportUploadType } from 'shared/utils/comparison'
Expand Down Expand Up @@ -41,16 +40,13 @@ interface URLParams {

function PullCoverageContent() {
const { owner, repo, pullId, provider } = useParams<URLParams>()
const { data: overview } = useRepoOverview({ provider, owner, repo })
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })

const { data } = useSuspenseQueryV5(
PullPageDataQueryOpts({
provider,
owner,
repo,
pullId,
isTeamPlan: (isTeamPlan && overview?.private) ?? false,
})
)

Expand Down Expand Up @@ -129,8 +125,6 @@ function PullCoverageContent() {

function PullCoverage() {
const { owner, repo, pullId, provider } = useParams<URLParams>()
const { data: overview } = useRepoOverview({ provider, owner, repo })
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })
const { data: rateLimit } = useRepoRateLimitStatus({ provider, owner, repo })

const { data } = useSuspenseQueryV5(
Expand All @@ -139,7 +133,6 @@ function PullCoverage() {
owner,
repo,
pullId,
isTeamPlan: (isTeamPlan && overview?.private) ?? false,
})
)

Expand Down
4 changes: 0 additions & 4 deletions src/pages/PullRequestPage/PullRequestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useLocation, useParams } from 'react-router-dom'
import NotFound from 'pages/NotFound'
import { useCrumbs } from 'pages/RepoPage/context'
import { useRepoOverview } from 'services/repo'
import { useIsTeamPlan } from 'services/useIsTeamPlan'
import Icon from 'ui/Icon'
import Spinner from 'ui/Spinner'
import SummaryDropdown from 'ui/SummaryDropdown'
Expand Down Expand Up @@ -89,8 +88,6 @@ function PullRequestPage() {
const location = useLocation()
const { provider, owner, repo, pullId } = useParams<URLParams>()
const { data: overview } = useRepoOverview({ provider, owner, repo })
const { data: isTeamPlan } = useIsTeamPlan({ provider, owner })

usePRPageBreadCrumbs({
owner,
repo,
Expand All @@ -104,7 +101,6 @@ function PullRequestPage() {
owner,
repo,
pullId,
isTeamPlan: (isTeamPlan && overview?.private) ?? false,
})
)

Expand Down
11 changes: 3 additions & 8 deletions src/pages/PullRequestPage/queries/PullPageDataQueryOpts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ query PullPageData(
$owner: String!
$repo: String!
$pullId: Int!
$isTeamPlan: Boolean!
) {
owner(username: $owner) {
repository(name: $repo) {
Expand Down Expand Up @@ -136,10 +135,10 @@ query PullPageData(
__typename
... on Comparison {
impactedFilesCount
indirectChangedFilesCount @skip(if: $isTeamPlan)
indirectChangedFilesCount
directChangedFilesCount
flagComparisonsCount @skip(if: $isTeamPlan)
componentComparisonsCount @skip(if: $isTeamPlan)
flagComparisonsCount
componentComparisonsCount
}
... on FirstPullRequest {
message
Expand Down Expand Up @@ -181,15 +180,13 @@ interface PullPageDataQueryArgs {
owner: string
repo: string
pullId: string
isTeamPlan?: boolean
}

export const PullPageDataQueryOpts = ({
provider,
owner,
repo,
pullId,
isTeamPlan = false,
}: PullPageDataQueryArgs) =>
queryOptionsV5({
queryKey: [
Expand All @@ -198,7 +195,6 @@ export const PullPageDataQueryOpts = ({
owner,
repo,
pullId,
isTeamPlan,
query,
],
queryFn: ({ signal }) =>
Expand All @@ -211,7 +207,6 @@ export const PullPageDataQueryOpts = ({
owner,
repo,
pullId: parseInt(pullId, 10),
isTeamPlan,
},
}).then((res) => {
const callingFn = 'PullPageDataQueryOpts'
Expand Down
Loading