Skip to content

Commit 0a46b1e

Browse files
authored
chore: remove swr and dead code (#3495)
1 parent 010f64e commit 0a46b1e

File tree

5 files changed

+9
-53
lines changed

5 files changed

+9
-53
lines changed

site/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"react-markdown": "8.0.3",
5050
"react-router-dom": "6.3.0",
5151
"sourcemapped-stacktrace": "1.1.11",
52-
"swr": "1.2.2",
5352
"tzdata": "1.0.30",
5453
"uuid": "8.3.2",
5554
"xstate": "4.32.1",

site/src/app.tsx

+9-29
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import CssBaseline from "@material-ui/core/CssBaseline"
22
import ThemeProvider from "@material-ui/styles/ThemeProvider"
33
import { FC } from "react"
44
import { BrowserRouter as Router } from "react-router-dom"
5-
import { SWRConfig } from "swr"
65
import { AppRouter } from "./AppRouter"
76
import { ErrorBoundary } from "./components/ErrorBoundary/ErrorBoundary"
87
import { GlobalSnackbar } from "./components/GlobalSnackbar/GlobalSnackbar"
@@ -13,34 +12,15 @@ import { XServiceProvider } from "./xServices/StateContext"
1312
export const App: FC = () => {
1413
return (
1514
<Router>
16-
<SWRConfig
17-
value={{
18-
// This code came from the SWR documentation:
19-
// https://swr.vercel.app/docs/error-handling#status-code-and-error-object
20-
fetcher: async (url: string) => {
21-
const res = await fetch(url)
22-
23-
// By default, `fetch` won't treat 4xx or 5xx response as errors.
24-
// However, we want SWR to treat these as errors - so if `res.ok` is false,
25-
// we want to throw an error to bubble that up to SWR.
26-
if (!res.ok) {
27-
const err = new Error((await res.json()).error?.message || res.statusText)
28-
throw err
29-
}
30-
return res.json()
31-
},
32-
}}
33-
>
34-
<ThemeProvider theme={dark}>
35-
<CssBaseline />
36-
<ErrorBoundary>
37-
<XServiceProvider>
38-
<AppRouter />
39-
<GlobalSnackbar />
40-
</XServiceProvider>
41-
</ErrorBoundary>
42-
</ThemeProvider>
43-
</SWRConfig>
15+
<ThemeProvider theme={dark}>
16+
<CssBaseline />
17+
<ErrorBoundary>
18+
<XServiceProvider>
19+
<AppRouter />
20+
<GlobalSnackbar />
21+
</XServiceProvider>
22+
</ErrorBoundary>
23+
</ThemeProvider>
4424
</Router>
4525
)
4626
}

site/src/util/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export * from "./array"
2-
export * from "./swr"

site/src/util/swr.ts

-17
This file was deleted.

site/yarn.lock

-5
Original file line numberDiff line numberDiff line change
@@ -13113,11 +13113,6 @@ svgo@^2.7.0:
1311313113
picocolors "^1.0.0"
1311413114
stable "^0.1.8"
1311513115

13116-
swr@1.2.2:
13117-
version "1.2.2"
13118-
resolved "https://registry.yarnpkg.com/swr/-/swr-1.2.2.tgz#6cae09928d30593a7980d80f85823e57468fac5d"
13119-
integrity sha512-ky0BskS/V47GpW8d6RU7CPsr6J8cr7mQD6+do5eky3bM0IyJaoi3vO8UhvrzJaObuTlGhPl2szodeB2dUd76Xw==
13120-
1312113116
symbol-tree@^3.2.4:
1312213117
version "3.2.4"
1312313118
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"

0 commit comments

Comments
 (0)