update the max amount of times the Antigravity transition banner can be displayed. (#27676)

This commit is contained in:
David Pierce
2026-06-05 14:35:13 +00:00
committed by GitHub
parent 4196596f7f
commit f40498db64
2 changed files with 19 additions and 3 deletions
+16 -2
View File
@@ -77,10 +77,24 @@ describe('useBanner', () => {
.update(defaultBannerData.defaultText)
.digest('hex')]: 5,
});
});
const { result } = await renderHook(() => useBanner(defaultBannerData));
it('should not hide banner if show count exceeds max limit (Legacy format) if it contains an Antigravity announcement', async () => {
const antigravityBannerData = {
defaultText: 'Antigravity is coming to town!',
warningText: '',
};
expect(result.current.bannerText).toBe('');
mockedPersistentStateGet.mockReturnValue({
[crypto
.createHash('sha256')
.update(antigravityBannerData.defaultText)
.digest('hex')]: 5,
});
const { result } = await renderHook(() => useBanner(antigravityBannerData));
expect(result.current.bannerText).toBe('Antigravity is coming to town!');
});
it('should increment the persistent count when banner is shown', async () => {
+3 -1
View File
@@ -41,7 +41,9 @@ export function useBanner(bannerData: BannerData) {
const currentBannerCount = bannerCounts[hashedText] || 0;
const showBanner =
activeText !== '' && currentBannerCount < DEFAULT_MAX_BANNER_SHOWN_COUNT;
activeText !== '' &&
(currentBannerCount < DEFAULT_MAX_BANNER_SHOWN_COUNT ||
activeText.includes('Antigravity'));
const rawBannerText = showBanner ? activeText : '';
const bannerText = rawBannerText.replace(/\\n/g, '\n');