Skip to content

Commit

Permalink
fix: works well with v1
Browse files Browse the repository at this point in the history
  • Loading branch information
koba04 committed Aug 26, 2021
1 parent 9170f48 commit e7aba55
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/swr-devtools-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react": "17.0.2",
"react-dom": "17.0.2",
"styled-components": "^5.3.0",
"swr": "^1.0.0-beta.13",
"swr": "^1.0.0-beta.14",
"swr-devtools": "0.1.0"
},
"devDependencies": {
Expand Down
44 changes: 27 additions & 17 deletions examples/swr-devtools-demo/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
import "../styles/globals.css";
import { /* SWRDevToolPanel, */ SWRDevTools } from "swr-devtools";
import { SWRConfig, useSWRConfig } from "swr";
import { SWRDevToolPanel, SWRDevTools } from "swr-devtools";

// The way to use SWR DevTools as a React Component
const DevToolsArea = () => (
<div
style={{
position: "fixed",
bottom: 0,
width: "100%",
height: "400px",
}}
>
{/* <SWRDevToolPanel cache={cache} /> */}
</div>
);
const DevToolsArea = () => {
const cache = useSWRConfig().cache;
return (
<div
style={{
position: "fixed",
bottom: 0,
width: "100%",
height: "400px",
}}
>
<SWRDevToolPanel cache={cache} />
</div>
);
};

function MyApp({ Component, pageProps }) {
return (
<SWRDevTools>
<Component {...pageProps} />
<DevToolsArea />
</SWRDevTools>
<SWRConfig
value={{
fetcher: (url) => fetch(url).then((r) => r.json()),
}}
>
<SWRDevTools>
<Component {...pageProps} />
<DevToolsArea />
</SWRDevTools>
</SWRConfig>
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/swr-devtools-extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"styled-components": "^5.3.0",
"swr": "^1.0.0-beta.13",
"swr": "^1.0.0-beta.14",
"swr-devtools": "0.1.0"
}
}
4 changes: 2 additions & 2 deletions packages/swr-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"peerDependencies": {
"react": "^17.0.2",
"styled-components": "^5.3.0",
"swr": "^1.0.0-beta.13"
"swr": "^1.0.0-beta.14"
},
"devDependencies": {
"@types/react": "^17.0.16",
"@types/styled-components": "^5.1.12",
"react": "^17.0.2",
"styled-components": "^5.3.0",
"swr": "^1.0.0-beta.13",
"swr": "^1.0.0-beta.14",
"typescript": "^4.1.3"
},
"dependencies": {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4473,10 +4473,10 @@ supports-color@^8.0.0:
dependencies:
has-flag "^4.0.0"

swr@^1.0.0-beta.13:
version "1.0.0-beta.13"
resolved "https://registry.yarnpkg.com/swr/-/swr-1.0.0-beta.13.tgz#f555bc1d314c69d42d665016f6c39e0881b9c58d"
integrity sha512-m5+KB6wA4YS1BVUfnZA51NbTF7uQ5YqP3crRwF1CrUvoRXn7TU0U/Zb2Il4hvW9QzzqwZwcbJQnlysLTdnYb/A==
swr@^1.0.0-beta.14:
version "1.0.0-beta.14"
resolved "https://registry.yarnpkg.com/swr/-/swr-1.0.0-beta.14.tgz#be0b74693df3906c8a6a84366afacc0553a7bb44"
integrity sha512-qpcKQDau6tTnci42xOzxJEGQfCvg6et3OMHFY87/EBdWr5IV1FCm+tsIEOWplR12yo5N1k/G32h42TGRBQCjcw==
dependencies:
dequal "2.0.2"

Expand Down

0 comments on commit e7aba55

Please sign in to comment.