Skip to content

Commit

Permalink
fix: send the panelshow event with SWRDevTools (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
koba04 committed Dec 20, 2022
1 parent 596e4c2 commit ed7b643
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/swr-devtools/src/SWRDevTools.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef } from "react";
import React, { useEffect, useRef } from "react";
import { SWRConfig } from "swr";
import { EventEmitter, createSWRDevtools } from "./createSWRDevTools";

Expand All @@ -15,6 +15,9 @@ if (typeof window !== "undefined") {

export const SWRDevTools = ({ children }: { children: React.ReactNode }) => {
const [swrdevtools, events] = useRef(createSWRDevtools()).current;
useEffect(() => {
window.postMessage({ type: "panelshow" });
}, []);
return (
<SWRDevToolsContext.Provider value={{ events }}>
<SWRConfig value={{ use: [swrdevtools] }}>{children}</SWRConfig>
Expand Down

1 comment on commit ed7b643

@vercel
Copy link

@vercel vercel bot commented on ed7b643 Dec 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

swr-devtools – ./

swr-devtools.vercel.app
swr-devtools-koba04.vercel.app
swr-devtools-git-main-koba04.vercel.app

Please sign in to comment.