diff --git a/site/package.json b/site/package.json index df565c0cbb1d1..99d65967c9ab6 100644 --- a/site/package.json +++ b/site/package.json @@ -49,7 +49,6 @@ "react-markdown": "8.0.3", "react-router-dom": "6.3.0", "sourcemapped-stacktrace": "1.1.11", - "swr": "1.2.2", "tzdata": "1.0.30", "uuid": "8.3.2", "xstate": "4.32.1", diff --git a/site/src/app.tsx b/site/src/app.tsx index 8782f663884d6..3595c8affca18 100644 --- a/site/src/app.tsx +++ b/site/src/app.tsx @@ -2,7 +2,6 @@ import CssBaseline from "@material-ui/core/CssBaseline" import ThemeProvider from "@material-ui/styles/ThemeProvider" import { FC } from "react" import { BrowserRouter as Router } from "react-router-dom" -import { SWRConfig } from "swr" import { AppRouter } from "./AppRouter" import { ErrorBoundary } from "./components/ErrorBoundary/ErrorBoundary" import { GlobalSnackbar } from "./components/GlobalSnackbar/GlobalSnackbar" @@ -13,34 +12,15 @@ import { XServiceProvider } from "./xServices/StateContext" export const App: FC = () => { return ( - { - const res = await fetch(url) - - // By default, `fetch` won't treat 4xx or 5xx response as errors. - // However, we want SWR to treat these as errors - so if `res.ok` is false, - // we want to throw an error to bubble that up to SWR. - if (!res.ok) { - const err = new Error((await res.json()).error?.message || res.statusText) - throw err - } - return res.json() - }, - }} - > - - - - - - - - - - + + + + + + + + + ) } diff --git a/site/src/util/index.ts b/site/src/util/index.ts index b492d0c2d17e1..c843a6a95d8e9 100644 --- a/site/src/util/index.ts +++ b/site/src/util/index.ts @@ -1,2 +1 @@ export * from "./array" -export * from "./swr" diff --git a/site/src/util/swr.ts b/site/src/util/swr.ts deleted file mode 100644 index 7936b270753f7..0000000000000 --- a/site/src/util/swr.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * unsafeSWRArgument - * - * Helper function for working with SWR / useSWR in the TypeScript world. - * TypeScript is helpful in enforcing type-safety, but SWR is designed to - * with the expectation that, if the argument is not available, an exception - * will be thrown. - * - * This just helps in abiding by those rules, explicitly, and lets us suppress - * the lint warning in a single place. - */ -export const unsafeSWRArgument = (arg: T | null | undefined): T => { - if (typeof arg === "undefined" || arg === null) { - throw "SWR: Expected exception because the argument is not available" - } - return arg -} diff --git a/site/yarn.lock b/site/yarn.lock index ffc7a7665beb4..9072c8848777c 100644 --- a/site/yarn.lock +++ b/site/yarn.lock @@ -13113,11 +13113,6 @@ svgo@^2.7.0: picocolors "^1.0.0" stable "^0.1.8" -swr@1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/swr/-/swr-1.2.2.tgz#6cae09928d30593a7980d80f85823e57468fac5d" - integrity sha512-ky0BskS/V47GpW8d6RU7CPsr6J8cr7mQD6+do5eky3bM0IyJaoi3vO8UhvrzJaObuTlGhPl2szodeB2dUd76Xw== - symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"