@@ -62,7 +62,8 @@ export default function InlineEditor({
6262 const minHeight = ( minLines * lineHeight ) + extraPadding ;
6363
6464 // Get viewport height and calculate max allowed height (e.g., 80% of viewport)
65- const viewportHeight = window . innerHeight ;
65+ // Use a default during SSR
66+ const viewportHeight = typeof window !== 'undefined' ? window . innerHeight : 800 ;
6667 const maxHeight = Math . floor ( viewportHeight * 0.8 ) ;
6768
6869 // Calculate height but limit to max screen height
@@ -73,7 +74,20 @@ export default function InlineEditor({
7374 return calculatedHeight ;
7475 } , [ ] ) ;
7576
76- const [ editorHeight , setEditorHeight ] = useState ( ( ) => calculateHeight ( initialQuery ) ) ;
77+ const [ editorHeight , setEditorHeight ] = useState ( ( ) => {
78+ // During SSR, use a default height calculation
79+ const lines = initialQuery . split ( '\n' ) . length ;
80+ const lineHeight = 24 ;
81+ const extraPadding = 20 ;
82+ const minLines = 3 ;
83+ const minHeight = ( minLines * lineHeight ) + extraPadding ;
84+ const defaultMaxHeight = 640 ; // 80% of 800px default
85+
86+ return Math . min (
87+ Math . max ( ( lines * lineHeight ) + extraPadding , minHeight ) ,
88+ defaultMaxHeight
89+ ) ;
90+ } ) ;
7791
7892 const updateHeightDirectly = useCallback ( ( newHeight : number ) => {
7993 if ( containerRef . current ) {
@@ -102,6 +116,11 @@ export default function InlineEditor({
102116
103117 // Handle window resize to recalculate max height
104118 useEffect ( ( ) => {
119+ // Only add resize listener on client side
120+ if ( typeof window === 'undefined' ) {
121+ return ;
122+ }
123+
105124 const handleResize = ( ) => {
106125 const newHeight = calculateHeight ( query ) ;
107126 updateHeightDirectly ( newHeight ) ;
0 commit comments