Skip to content

Commit f40498d

Browse files
authored
update the max amount of times the Antigravity transition banner can be displayed. (#27676)
1 parent 4196596 commit f40498d

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

packages/cli/src/ui/hooks/useBanner.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,24 @@ describe('useBanner', () => {
7777
.update(defaultBannerData.defaultText)
7878
.digest('hex')]: 5,
7979
});
80+
});
81+
82+
it('should not hide banner if show count exceeds max limit (Legacy format) if it contains an Antigravity announcement', async () => {
83+
const antigravityBannerData = {
84+
defaultText: 'Antigravity is coming to town!',
85+
warningText: '',
86+
};
87+
88+
mockedPersistentStateGet.mockReturnValue({
89+
[crypto
90+
.createHash('sha256')
91+
.update(antigravityBannerData.defaultText)
92+
.digest('hex')]: 5,
93+
});
8094

81-
const { result } = await renderHook(() => useBanner(defaultBannerData));
95+
const { result } = await renderHook(() => useBanner(antigravityBannerData));
8296

83-
expect(result.current.bannerText).toBe('');
97+
expect(result.current.bannerText).toBe('Antigravity is coming to town!');
8498
});
8599

86100
it('should increment the persistent count when banner is shown', async () => {

packages/cli/src/ui/hooks/useBanner.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export function useBanner(bannerData: BannerData) {
4141
const currentBannerCount = bannerCounts[hashedText] || 0;
4242

4343
const showBanner =
44-
activeText !== '' && currentBannerCount < DEFAULT_MAX_BANNER_SHOWN_COUNT;
44+
activeText !== '' &&
45+
(currentBannerCount < DEFAULT_MAX_BANNER_SHOWN_COUNT ||
46+
activeText.includes('Antigravity'));
4547

4648
const rawBannerText = showBanner ? activeText : '';
4749
const bannerText = rawBannerText.replace(/\\n/g, '\n');

0 commit comments

Comments
 (0)