Skip to content

Commit 362c764

Browse files
committed
Fix SSR crash for write page
1 parent 4810337 commit 362c764

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/write/WriteMarkdownEditor.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,16 @@ function WriterHead({
199199
hide: boolean;
200200
children: React.ReactNode;
201201
}) {
202+
const screenHeight =
203+
(typeof window !== 'undefined' && window.screen.height) || 0;
204+
202205
const springStyle = useSpring({
203-
maxHeight: hide ? 0 : window.screen.height * 0.5,
206+
maxHeight: hide ? 0 : screenHeight * 0.5,
204207
opacity: hide ? 0 : 1,
205208
config: {
206209
duration: 300,
207210
},
208211
});
209-
210212
return (
211213
<animated.div style={springStyle}>
212214
<PaddingWrapper>{children}</PaddingWrapper>

0 commit comments

Comments
 (0)