mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
Removes unused and straightforward `next` imports in
`packages/ui-patterns` (and a dead `next/navigation` test mock in
`packages/ui`) that do not require a framework adapter.
**Removed:**
- Unused `LW15Banner`, `AnnouncementBanner`, `Announcement`, and
`PromoToast` components and their `package.json` exports
- Unused `HIDE_PROMO_TOAST` local storage key (only `PromoToast` read
it)
- Unused `next/navigation` mock from `packages/ui/vitest.setup.ts`
**Changed:**
- `PrivacySettings`: replace external `next/link` anchors with plain
`<a>` tags
- `Markdown/components` & `SqlToRest`: replace `next/dynamic` with
`React.lazy` + `Suspense` (plus a client-mount guard in `SqlToRest` to
preserve `{ ssr: false }`)
- `McpUrlBuilder` (`McpConfigurationDisplay` & `InstructionBlocks`):
replace `next/image` with plain `<img>` for static bundled
icons/screenshots. Both now share `normalizeAssetUrl` from
`mcpIconAssets.ts`, and the screenshot is lazy-loaded
- `types/assets.d.ts`: type `*.png` / `*.svg` imports as `string | {
src: string }` instead of `import('next/image').StaticImageData` (Vite
returns a string, Next returns an object, and consumers only read `src`)
## To test
- Run `packages/ui-patterns` and `packages/ui` unit tests and typecheck
- Open the MCP connect panel in Studio / Docs and confirm client icons
and setup screenshots render
- Open Privacy Settings modal in WWW / Docs and verify links open
properly
- Check SQL-to-REST translator page in Docs renders client-side
---------
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
24 lines
576 B
TypeScript
24 lines
576 B
TypeScript
/// <reference types="@testing-library/jest-dom" />
|
|
import '@testing-library/jest-dom/vitest'
|
|
|
|
import { cleanup } from '@testing-library/react'
|
|
import { afterEach, vi } from 'vitest'
|
|
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: vi.fn().mockImplementation((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: vi.fn(), // deprecated
|
|
removeListener: vi.fn(), // deprecated
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
dispatchEvent: vi.fn(),
|
|
})),
|
|
})
|
|
|
|
afterEach(() => {
|
|
cleanup()
|
|
})
|