mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem The `logs.all` Management API endpoint retired on September 23, and the deprecation banner stopped rendering on September 24 because of its hardcoded expiry. The banner's code is now dead weight in the bundle. Resolves GROWTH-1104. ## Solution Removes the banner and everything it pulled in: - Deletes `BannerLogsAllDeprecation.tsx`, plus its mount effect, expiry timer, and exposure tracking in `AppBannerWrapper.tsx`. - Removes `isLogsOrObservabilityPath` (only this banner used it) and its tests. - Removes `BANNER_ID.LOGS_ALL_DEPRECATION`. `BannerStackProvider.test.tsx` used it as an arbitrary ID, so those tests now use `BANNER_ID.EXPLORER`. The tests themselves are unchanged. - Removes the `LOGS_ALL_DEPRECATION_2026_09_23` local storage key and the two `logs_all_deprecation_banner_*` telemetry events. The dismissal key stays in users' browsers, which is harmless because nothing reads it anymore. ## Review instructions 1. Open a project's Logs or Observability page on the preview and confirm no `logs.all` notice appears and the page renders normally. 2. Open an organization's landing page and confirm the Terms of Service banner still behaves as before. ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
101 lines
2.3 KiB
TypeScript
101 lines
2.3 KiB
TypeScript
import { act, renderHook } from '@testing-library/react'
|
|
import { type PropsWithChildren } from 'react'
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
import { BANNER_ID, BannerStackProvider, useBannerStack } from './BannerStackProvider'
|
|
|
|
const wrapper = ({ children }: PropsWithChildren) => (
|
|
<BannerStackProvider>{children}</BannerStackProvider>
|
|
)
|
|
|
|
describe('BannerStackProvider', () => {
|
|
beforeEach(() => {
|
|
vi.useFakeTimers()
|
|
})
|
|
|
|
afterEach(() => {
|
|
vi.useRealTimers()
|
|
})
|
|
|
|
it('keeps a banner that is revived before the dismiss animation finishes', () => {
|
|
const { result } = renderHook(() => useBannerStack(), { wrapper })
|
|
|
|
act(() => {
|
|
result.current.addBanner({
|
|
id: BANNER_ID.EXPLORER,
|
|
isDismissed: false,
|
|
content: null,
|
|
})
|
|
})
|
|
|
|
act(() => {
|
|
result.current.dismissBanner(BANNER_ID.EXPLORER)
|
|
})
|
|
|
|
act(() => {
|
|
result.current.addBanner({
|
|
id: BANNER_ID.EXPLORER,
|
|
isDismissed: false,
|
|
content: null,
|
|
})
|
|
})
|
|
|
|
act(() => {
|
|
vi.advanceTimersByTime(300)
|
|
})
|
|
|
|
expect(result.current.banners).toEqual([
|
|
expect.objectContaining({
|
|
id: BANNER_ID.EXPLORER,
|
|
isDismissed: false,
|
|
}),
|
|
])
|
|
})
|
|
|
|
it('removes a banner after the dismiss animation when it stays dismissed', () => {
|
|
const { result } = renderHook(() => useBannerStack(), { wrapper })
|
|
|
|
act(() => {
|
|
result.current.addBanner({
|
|
id: BANNER_ID.EXPLORER,
|
|
isDismissed: false,
|
|
content: null,
|
|
})
|
|
})
|
|
|
|
act(() => {
|
|
result.current.dismissBanner(BANNER_ID.EXPLORER)
|
|
})
|
|
|
|
expect(result.current.banners[0]?.isDismissed).toBe(true)
|
|
|
|
act(() => {
|
|
vi.advanceTimersByTime(300)
|
|
})
|
|
|
|
expect(result.current.banners).toEqual([])
|
|
})
|
|
|
|
it('cancels the pending removal when the provider unmounts', () => {
|
|
const { result, unmount } = renderHook(() => useBannerStack(), { wrapper })
|
|
|
|
act(() => {
|
|
result.current.addBanner({
|
|
id: BANNER_ID.EXPLORER,
|
|
isDismissed: false,
|
|
content: null,
|
|
})
|
|
})
|
|
|
|
act(() => {
|
|
result.current.dismissBanner(BANNER_ID.EXPLORER)
|
|
})
|
|
|
|
expect(vi.getTimerCount()).toBe(1)
|
|
|
|
unmount()
|
|
|
|
expect(vi.getTimerCount()).toBe(0)
|
|
})
|
|
})
|