Skip to content

Commit 305c884

Browse files
Merge branch 'main' into cy/no_tokenless_banner_signed_out
2 parents f732223 + 4b05dff commit 305c884

File tree

5 files changed

+40
-56
lines changed

5 files changed

+40
-56
lines changed

src/App.test.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ const mockNavigatorData = {
135135
},
136136
}
137137

138+
const mockOwnerContext = { owner: { ownerid: 123 } }
139+
140+
const mockRepoContext = {
141+
owner: {
142+
repository: { __typename: 'Repository', repoid: 321, private: false },
143+
},
144+
}
145+
138146
const queryClient = new QueryClient({
139147
defaultOptions: { queries: { retry: false } },
140148
})
@@ -249,6 +257,12 @@ describe('App', () => {
249257
}),
250258
graphql.query('NavigatorData', () => {
251259
return HttpResponse.json({ data: mockNavigatorData })
260+
}),
261+
graphql.query('OwnerContext', () => {
262+
return HttpResponse.json({ data: mockOwnerContext })
263+
}),
264+
graphql.query('RepoContext', () => {
265+
return HttpResponse.json({ data: mockRepoContext })
252266
})
253267
)
254268
}

src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.test.tsx

-8
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ import { MemoryRouter, Route } from 'react-router-dom'
1313

1414
import BundleSelection from './BundleSelection'
1515

16-
const mocks = vi.hoisted(() => ({
17-
useFlags: vi.fn().mockReturnValue({ displayBundleCachingModal: true }),
18-
}))
19-
20-
vi.mock('shared/featureFlags', () => ({
21-
useFlags: mocks.useFlags,
22-
}))
23-
2416
const mockRepoOverview = {
2517
__typename: 'Repository',
2618
private: false,

src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/BundleSelection.tsx

+13-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { lazy, useCallback, useRef, useState } from 'react'
22

33
import { ConfigureCachedBundleModal } from 'pages/RepoPage/shared/ConfigureCachedBundleModal/ConfigureCachedBundleModal'
4-
import { useFlags } from 'shared/featureFlags'
54
import Icon from 'ui/Icon'
65

76
import BranchSelector from './BranchSelector'
@@ -16,10 +15,6 @@ const BundleSelection: React.FC = () => {
1615

1716
const [showBundleCachingModal, setShowBundleCachingModal] = useState(false)
1817

19-
const { displayBundleCachingModal } = useFlags({
20-
displayBundleCachingModal: false,
21-
})
22-
2318
const resetFilterSelects = useCallback(() => {
2419
typesSelectRef.current?.resetSelected()
2520
loadingSelectRef?.current?.resetSelected()
@@ -40,21 +35,19 @@ const BundleSelection: React.FC = () => {
4035
/>
4136
<TypeSelector ref={typesSelectRef} />
4237
<LoadSelector ref={loadingSelectRef} />
43-
{displayBundleCachingModal ? (
44-
<div className="flex w-full justify-end self-start md:w-auto">
45-
<button
46-
onClick={() => setShowBundleCachingModal(true)}
47-
className="flex items-center gap-0.5 text-xs font-semibold text-ds-blue-darker hover:cursor-pointer hover:underline"
48-
>
49-
<Icon name="cog" size="sm" variant="outline" />
50-
Configure data caching
51-
</button>
52-
<ConfigureCachedBundleModal
53-
isOpen={showBundleCachingModal}
54-
setIsOpen={setShowBundleCachingModal}
55-
/>
56-
</div>
57-
) : null}
38+
<div className="flex w-full justify-end self-start md:w-auto">
39+
<button
40+
onClick={() => setShowBundleCachingModal(true)}
41+
className="flex items-center gap-0.5 text-xs font-semibold text-ds-blue-darker hover:cursor-pointer hover:underline"
42+
>
43+
<Icon name="cog" size="sm" variant="outline" />
44+
Configure data caching
45+
</button>
46+
<ConfigureCachedBundleModal
47+
isOpen={showBundleCachingModal}
48+
setIsOpen={setShowBundleCachingModal}
49+
/>
50+
</div>
5851
</div>
5952
</div>
6053
)

src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.test.tsx

-8
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ import { MemoryRouter, Route } from 'react-router'
1414
import ConfigurationManager from './ConfigurationManager'
1515
import { RepositoryConfiguration } from './hooks/useRepoConfigurationStatus/RepoConfigurationStatusQueryOpts'
1616

17-
const mocks = vi.hoisted(() => ({
18-
useFlags: vi.fn().mockReturnValue({ displayBundleCachingModal: true }),
19-
}))
20-
21-
vi.mock('shared/featureFlags', () => ({
22-
useFlags: mocks.useFlags,
23-
}))
24-
2517
interface mockRepoConfigArgs {
2618
isTeamPlan?: boolean
2719
flags?: boolean

src/pages/RepoPage/ConfigTab/tabs/ConfigurationManager/ConfigurationManager.tsx

+13-20
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useState } from 'react'
33
import { useParams } from 'react-router'
44

55
import { ConfigureCachedBundleModal } from 'pages/RepoPage/shared/ConfigureCachedBundleModal/ConfigureCachedBundleModal'
6-
import { useFlags } from 'shared/featureFlags'
76
import Icon from 'ui/Icon'
87

98
import FeatureGroup from './components/FeatureGroup'
@@ -144,10 +143,6 @@ function TestAnalyticsConfiguration({
144143
function BundleAnalysisConfiguration({
145144
repoConfiguration,
146145
}: ConfigurationGroupProps) {
147-
const { displayBundleCachingModal } = useFlags({
148-
displayBundleCachingModal: false,
149-
})
150-
151146
const [showBundleCachingModal, setShowBundleCachingModal] = useState(false)
152147
const jsOrTsPresent = !!repoConfiguration?.repository?.languages?.some(
153148
(lang) =>
@@ -177,21 +172,19 @@ function BundleAnalysisConfiguration({
177172
>
178173
Track, monitor, and manage your bundle
179174
</FeatureItem>
180-
{displayBundleCachingModal ? (
181-
<div>
182-
<button
183-
onClick={() => setShowBundleCachingModal(true)}
184-
className="flex items-center gap-0.5 text-xs font-semibold text-ds-blue-darker hover:cursor-pointer hover:underline"
185-
>
186-
<Icon name="cog" size="sm" variant="outline" />
187-
Configure data caching
188-
</button>
189-
<ConfigureCachedBundleModal
190-
isOpen={showBundleCachingModal}
191-
setIsOpen={setShowBundleCachingModal}
192-
/>
193-
</div>
194-
) : null}
175+
<div>
176+
<button
177+
onClick={() => setShowBundleCachingModal(true)}
178+
className="flex items-center gap-0.5 text-xs font-semibold text-ds-blue-darker hover:cursor-pointer hover:underline"
179+
>
180+
<Icon name="cog" size="sm" variant="outline" />
181+
Configure data caching
182+
</button>
183+
<ConfigureCachedBundleModal
184+
isOpen={showBundleCachingModal}
185+
setIsOpen={setShowBundleCachingModal}
186+
/>
187+
</div>
195188
</FeatureGroup.UniversalItems>
196189
</FeatureGroup>
197190
)

0 commit comments

Comments
 (0)