Skip to content

Commit 52d6486

Browse files
authored
Fix/window issue (#11)
* fix #10 ssr issue * fix issue around SSR
1 parent 2d7fa8f commit 52d6486

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-hook-form-devtools",
3-
"version": "1.1.1",
3+
"version": "1.1.2-beta.1",
44
"description": "React Hook Form dev tool to help debugging forms",
55
"main": "dist/react-hook-form-devtools.js",
66
"module": "dist/react-hook-form-devtools.es.js",

src/devTool.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@ import {
77
import { Control } from 'react-hook-form';
88
import { DevToolUI } from './devToolUI';
99

10-
setStorageType(window.localStorage);
10+
if (typeof window !== 'undefined') {
11+
setStorageType(window.localStorage);
12+
}
1113

12-
createStore({
13-
visible: true,
14-
isCollapse: false,
15-
filterName: '',
16-
}, {
17-
name: "__REACT_HOOK_FORM_DEVTOOLS__"
18-
});
14+
createStore(
15+
{
16+
visible: true,
17+
isCollapse: false,
18+
filterName: '',
19+
},
20+
{
21+
name: '__REACT_HOOK_FORM_DEVTOOLS__',
22+
},
23+
);
1924

2025
export const DevTool = ({ control }: { control: Control }) => {
2126
return (

src/settingAction.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ export function setCollapse(state: any, payload: any) {
1111
isCollapse: payload,
1212
};
1313
}
14-

0 commit comments

Comments
 (0)