File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
packages/react-devtools/src Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,19 @@ const convertRender = (
25
25
setComponent ( typeof Component === 'function' ? Component ( ) : Component )
26
26
}
27
27
28
+ let hydrated = false
29
+
30
+ const useHydrated = ( ) => {
31
+ useEffect ( ( ) => {
32
+ if ( ! hydrated ) {
33
+ hydrated = true
34
+ }
35
+ } , [ ] )
36
+ return hydrated
37
+ }
38
+
28
39
export const Devtools = ( { plugins, options } : DevtoolsProps ) => {
40
+ const isHydrated = useHydrated ( )
29
41
const devToolRef = useRef < HTMLDivElement > ( null )
30
42
const [ PluginComponent , setPluginComponent ] = useState < JSX . Element | null > (
31
43
null ,
@@ -57,6 +69,8 @@ export const Devtools = ({ plugins, options }: DevtoolsProps) => {
57
69
devtools . unmount ( )
58
70
}
59
71
} , [ devtools ] )
72
+ // we only render on the client side after hydration
73
+ if ( ! isHydrated ) return null
60
74
const pluginContainer = document . getElementById ( PLUGIN_CONTAINER_ID )
61
75
const titleContainer = document . getElementById ( PLUGIN_TITLE_CONTAINER_ID )
62
76
return (
You can’t perform that action at this time.
0 commit comments