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

chore: Remove bundle analysis flags #2693

Merged
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
11 changes: 0 additions & 11 deletions src/pages/CommitDetailPage/CommitDetailPage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ import { setupServer } from 'msw/node'
import { Suspense } from 'react'
import { MemoryRouter, Route } from 'react-router-dom'

import { useFlags } from 'shared/featureFlags'

import CommitPage from './CommitDetailPage'

jest.mock('ui/TruncatedMessage/hooks')
jest.mock('./Header', () => () => 'Header')
jest.mock('./CommitCoverage', () => () => 'CommitCoverage')
jest.mock('./CommitBundleAnalysis', () => () => 'CommitBundleAnalysis')

jest.mock('shared/featureFlags')
const mockedUseFlags = useFlags as jest.Mock<{
bundleAnalysisPrAndCommitPages: boolean
}>

const mockNotFoundCommit = {
owner: {
isCurrentUserPartOfOrg: false,
Expand Down Expand Up @@ -146,10 +139,6 @@ describe('CommitDetailPage', () => {
bundleAnalysisEnabled: false,
}
) {
mockedUseFlags.mockReturnValue({
bundleAnalysisPrAndCommitPages: true,
})

server.use(
graphql.query('CommitPageData', (req, res, ctx) => {
if (notFoundCommit) {
Expand Down
13 changes: 2 additions & 11 deletions src/pages/CommitDetailPage/CommitDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { lazy, Suspense } from 'react'
import { useLocation, useParams } from 'react-router-dom'

import NotFound from 'pages/NotFound'
import { useFlags } from 'shared/featureFlags'
import Breadcrumb from 'ui/Breadcrumb'
import Spinner from 'ui/Spinner'
import SummaryDropdown from 'ui/SummaryDropdown'
Expand Down Expand Up @@ -43,10 +42,6 @@ const CommitDetailPage: React.FC = () => {
const { provider, owner, repo, commit: commitSha } = useParams<URLParams>()
const shortSHA = commitSha?.slice(0, 7)

const { bundleAnalysisPrAndCommitPages } = useFlags({
bundleAnalysisPrAndCommitPages: false,
})

// reset cache when user navigates to the commit detail page
const queryClient = useQueryClient()
queryClient.setQueryData(['IgnoredUploadIds'], [])
Expand All @@ -71,8 +66,7 @@ const CommitDetailPage: React.FC = () => {
let displayMode: TDisplayMode = DISPLAY_MODE.COVERAGE
if (
commitPageData?.bundleAnalysisEnabled &&
commitPageData?.coverageEnabled &&
bundleAnalysisPrAndCommitPages
commitPageData?.coverageEnabled
) {
const queryString = qs.parse(location.search, {
ignoreQueryPrefix: true,
Expand All @@ -86,10 +80,7 @@ const CommitDetailPage: React.FC = () => {
}

displayMode = DISPLAY_MODE.BOTH
} else if (
commitPageData?.bundleAnalysisEnabled &&
bundleAnalysisPrAndCommitPages
) {
} else if (commitPageData?.bundleAnalysisEnabled) {
displayMode = DISPLAY_MODE.BUNDLE_ANALYSIS
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ import { setupServer } from 'msw/node'
import { mockIsIntersecting } from 'react-intersection-observer/test-utils'
import { MemoryRouter, Route } from 'react-router-dom'

import { useFlags } from 'shared/featureFlags'

import CommitsTable from './CommitsTable'

jest.mock('shared/featureFlags')
const mockedUseFlags = useFlags as jest.Mock<{
bundleAnalysisPrAndCommitPages: boolean
}>

const mockRepoOverview = (bundleAnalysisEnabled = false) => ({
owner: {
repository: {
Expand Down Expand Up @@ -152,10 +145,6 @@ describe('CommitsTable', () => {
}: SetupArgs) {
const queryClient = new QueryClient()

mockedUseFlags.mockReturnValue({
bundleAnalysisPrAndCommitPages: true,
})

server.use(
graphql.query('GetRepoOverview', (req, res, ctx) => {
return res(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { useParams } from 'react-router-dom'

import { useCommits } from 'services/commits/useCommits'
import { useRepoOverview } from 'services/repo'
import { useFlags } from 'shared/featureFlags'
import Spinner from 'ui/Spinner'

import { createCommitsTableData } from './createCommitsTableData'
Expand Down Expand Up @@ -89,9 +88,6 @@ const CommitsTable = () => {
const { ref, inView } = useInView()
const { provider, owner, repo, pullId } = useParams<URLParams>()
const { data: overview } = useRepoOverview({ provider, owner, repo })
const { bundleAnalysisPrAndCommitPages } = useFlags({
bundleAnalysisPrAndCommitPages: false,
})

const {
data: commitsData,
Expand Down Expand Up @@ -122,8 +118,7 @@ const CommitsTable = () => {
const columns = useMemo(() => {
if (
overview?.bundleAnalysisEnabled &&
!baseColumns.some((column) => column.id === 'bundleAnalysis') &&
bundleAnalysisPrAndCommitPages
!baseColumns.some((column) => column.id === 'bundleAnalysis')
) {
return [
...baseColumns,
Expand All @@ -136,7 +131,7 @@ const CommitsTable = () => {
}

return baseColumns
}, [bundleAnalysisPrAndCommitPages, overview?.bundleAnalysisEnabled])
}, [overview?.bundleAnalysisEnabled])

const table = useReactTable({
columns,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ import { setupServer } from 'msw/node'
import { mockIsIntersecting } from 'react-intersection-observer/test-utils'
import { MemoryRouter, Route } from 'react-router-dom'

import { useFlags } from 'shared/featureFlags'

import CommitsTableTeam from './CommitsTableTeam'

jest.mock('shared/featureFlags')
const mockedUseFlags = useFlags as jest.Mock<{
bundleAnalysisPrAndCommitPages: boolean
}>

const mockRepoOverview = (bundleAnalysisEnabled = false) => ({
owner: {
repository: {
Expand Down Expand Up @@ -128,10 +121,6 @@ describe('CommitsTableTeam', () => {
}: SetupArgs) {
const queryClient = new QueryClient()

mockedUseFlags.mockReturnValue({
bundleAnalysisPrAndCommitPages: true,
})

server.use(
graphql.query('GetRepoOverview', (req, res, ctx) => {
return res(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { useParams } from 'react-router-dom'

import { useCommitsTeam } from 'services/commits'
import { useRepoOverview } from 'services/repo'
import { useFlags } from 'shared/featureFlags'
import Spinner from 'ui/Spinner'
import 'ui/Table/Table.css'

Expand Down Expand Up @@ -77,9 +76,6 @@ export default function CommitsTableTeam() {
const { provider, owner, repo, pullId } = useParams<URLParams>()
const { ref, inView } = useInView()
const { data: overview } = useRepoOverview({ provider, owner, repo })
const { bundleAnalysisPrAndCommitPages } = useFlags({
bundleAnalysisPrAndCommitPages: false,
})

const {
data: commitsData,
Expand Down Expand Up @@ -110,8 +106,7 @@ export default function CommitsTableTeam() {
const columns = useMemo(() => {
if (
overview?.bundleAnalysisEnabled &&
!baseColumns.some((column) => column.id === 'bundleAnalysis') &&
bundleAnalysisPrAndCommitPages
!baseColumns.some((column) => column.id === 'bundleAnalysis')
) {
return [
...baseColumns,
Expand All @@ -124,7 +119,7 @@ export default function CommitsTableTeam() {
}

return baseColumns
}, [bundleAnalysisPrAndCommitPages, overview?.bundleAnalysisEnabled])
}, [overview?.bundleAnalysisEnabled])

const table = useReactTable({
columns,
Expand Down
2 changes: 0 additions & 2 deletions src/pages/PullRequestPage/PullRequestPage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import PullRequestPage from './PullRequestPage'
jest.mock('shared/featureFlags')
const mockedUseFlags = useFlags as jest.Mock<{
multipleTiers: boolean
bundleAnalysisPrAndCommitPages: boolean
}>

jest.mock('./Header', () => () => 'Header')
Expand Down Expand Up @@ -189,7 +188,6 @@ describe('PullRequestPage', () => {
}: SetupArgs) {
mockedUseFlags.mockReturnValue({
multipleTiers: true,
bundleAnalysisPrAndCommitPages: true,
})

server.use(
Expand Down
11 changes: 3 additions & 8 deletions src/pages/PullRequestPage/PullRequestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ const Loader = () => (
function PullRequestPage() {
const location = useLocation()
const { provider, owner, repo, pullId } = useParams<URLParams>()
const { multipleTiers, bundleAnalysisPrAndCommitPages } = useFlags({
const { multipleTiers } = useFlags({
multipleTiers: false,
bundleAnalysisPrAndCommitPages: false,
})

const { data: overview } = useRepoOverview({ provider, owner, repo })
Expand All @@ -68,11 +67,7 @@ function PullRequestPage() {
let defaultDropdown: Array<'coverage' | 'bundle'> = []
// default to displaying only coverage
let displayMode: TDisplayMode = DISPLAY_MODE.COVERAGE
if (
data?.bundleAnalysisEnabled &&
data?.coverageEnabled &&
bundleAnalysisPrAndCommitPages
) {
if (data?.bundleAnalysisEnabled && data?.coverageEnabled) {
const queryString = qs.parse(location.search, {
ignoreQueryPrefix: true,
depth: 1,
Expand All @@ -85,7 +80,7 @@ function PullRequestPage() {
}

displayMode = DISPLAY_MODE.BOTH
} else if (data?.bundleAnalysisEnabled && bundleAnalysisPrAndCommitPages) {
} else if (data?.bundleAnalysisEnabled) {
displayMode = DISPLAY_MODE.BUNDLE_ANALYSIS
}

Expand Down
Loading
Loading