We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 596e4c2 commit ed7b643Copy full SHA for ed7b643
packages/swr-devtools/src/SWRDevTools.tsx
@@ -1,4 +1,4 @@
1
-import React, { useRef } from "react";
+import React, { useEffect, useRef } from "react";
2
import { SWRConfig } from "swr";
3
import { EventEmitter, createSWRDevtools } from "./createSWRDevTools";
4
@@ -15,6 +15,9 @@ if (typeof window !== "undefined") {
15
16
export const SWRDevTools = ({ children }: { children: React.ReactNode }) => {
17
const [swrdevtools, events] = useRef(createSWRDevtools()).current;
18
+ useEffect(() => {
19
+ window.postMessage({ type: "panelshow" });
20
+ }, []);
21
return (
22
<SWRDevToolsContext.Provider value={{ events }}>
23
<SWRConfig value={{ use: [swrdevtools] }}>{children}</SWRConfig>
0 commit comments