The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
remove swr
Alaister Young9dc94df2b7b5
diff --git a/package-lock.json b/package-lock.jsonindex 51dde1c8beb..29bb5c44a47 100644--- a/package-lock.json+++ b/package-lock.json@@ -37646,7 +37646,6 @@"semver": "^6.3.0","shared-data": "*","sqlstring": "^2.3.2",- "swr": "^1.2.1","ui": "*","uniforms-bootstrap4": "^3.6.2","uniforms-bridge-json-schema": "^3.6.2",@@ -37918,14 +37917,6 @@"react-dom": "^16.0.0 || ^17.0.0"}},- "studio/node_modules/swr": {- "version": "1.3.0",- "resolved": "https://registry.npmjs.org/swr/-/swr-1.3.0.tgz",- "integrity": "sha512-dkghQrOl2ORX9HYrMDtPa7LTVHJjCTeZoB1dqTbnnEDlSvN8JEKpYIYurDfvbQFUUS8Cg8PceFVZNkW0KNNYPw==",- "peerDependencies": {- "react": "^16.11.0 || ^17.0.0 || ^18.0.0"- }- },"studio/node_modules/typescript": {"version": "4.8.4","resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",@@ -63466,7 +63457,6 @@"shared-data": "*","sqlstring": "^2.3.2","storybook-dark-mode": "^1.0.4",- "swr": "^1.2.1","tailwindcss": "^3.0.22","ts-jest": "^27.0.7","typescript": "4.8.4",@@ -63661,12 +63651,6 @@"reduce-css-calc": "^2.1.8"}},- "swr": {- "version": "1.3.0",- "resolved": "https://registry.npmjs.org/swr/-/swr-1.3.0.tgz",- "integrity": "sha512-dkghQrOl2ORX9HYrMDtPa7LTVHJjCTeZoB1dqTbnnEDlSvN8JEKpYIYurDfvbQFUUS8Cg8PceFVZNkW0KNNYPw==",- "requires": {}- },"typescript": {"version": "4.8.4","resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",diff --git a/studio/package.json b/studio/package.jsonindex b579303f7a3..88ad5ec1eca 100644--- a/studio/package.json+++ b/studio/package.json@@ -84,7 +84,6 @@"semver": "^6.3.0","shared-data": "*","sqlstring": "^2.3.2",- "swr": "^1.2.1","ui": "*","uniforms-bootstrap4": "^3.6.2","uniforms-bridge-json-schema": "^3.6.2",diff --git a/studio/tests/components/Home/ProjectUsage.test.js b/studio/tests/components/Home/ProjectUsage.test.jsindex fe283b983c9..a8e250d3d3c 100644--- a/studio/tests/components/Home/ProjectUsage.test.js+++ b/studio/tests/components/Home/ProjectUsage.test.js@@ -10,17 +10,32 @@ import { clickDropdown } from 'tests/helpers'const mockPush = jest.fn()useRouter.mockReturnValue({ query: { ref: '123' }, push: mockPush })-// need to wrap component with SWRConfig in order to clear cache between tests+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'+// TODO: abstract out to global setup-import { SWRConfig } from 'swr'const ProjectUsage = jest.fn()ProjectUsage.mockImplementation((props) => {const Original = jest.requireActual('components/interfaces/Home/ProjectUsage').default- // wrap with SWR to reset the cache each time++ const queryClient = new QueryClient({+ defaultOptions: {+ queries: {+ retry: false,+ },+ },+ logger: {+ log: console.log,+ warn: console.warn,+ // ✅ no more errors on the console for tests+ error: process.env.NODE_ENV === 'test' ? () => {} : console.error,+ },+ })++ // wrap with QueryClient to reset the cache each timereturn (- <SWRConfig value={{ provider: () => new Map() }}>+ <QueryClientProvider client={queryClient}><Original {...props} />- </SWRConfig>+ </QueryClientProvider>)})@@ -31,6 +46,7 @@ jest.mock('hooks')import { useFlag } from 'hooks'jest.mock('data/subscriptions/project-subscription-query')import { useProjectSubscriptionQuery } from 'data/subscriptions/project-subscription-query'+useFlag.mockReturnValue(true)useProjectSubscriptionQuery.mockReturnValue({data: undefined,diff --git a/studio/tests/helpers.tsx b/studio/tests/helpers.tsxindex b3032a492b8..6893fc6e2b7 100644--- a/studio/tests/helpers.tsx+++ b/studio/tests/helpers.tsx@@ -1,7 +1,7 @@import { screen, getByText, fireEvent } from '@testing-library/react'import React, { useState } from 'react'-import { SWRConfig } from 'swr'+import { QueryClient, QueryClientProvider } from '@tanstack/react-query'import { render as originalRender } from '@testing-library/react'import { RootStore } from 'stores'import { StoreProvider } from 'hooks'@@ -49,16 +49,26 @@ export const clickDropdown = (elem: HTMLElement) => {const SwrTestConfig: React.FC = ({ children }) => {const [rootStore] = useState(() => new RootStore())+ const [queryClient] = useState(+ () =>+ new QueryClient({+ defaultOptions: {+ queries: {+ retry: false,+ },+ },+ logger: {+ log: console.log,+ warn: console.warn,+ // ✅ no more errors on the console for tests+ error: process.env.NODE_ENV === 'test' ? () => {} : console.error,+ },+ })+ )+return (<StoreProvider rootStore={rootStore}>- <SWRConfig- value={{- provider: () => new Map(),- shouldRetryOnError: false,- }}- >- {children}- </SWRConfig>+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider></StoreProvider>)}