@@ -24,7 +24,14 @@ import {
24
24
WorkspaceBuildDataSkeleton ,
25
25
} from "modules/workspaces/WorkspaceBuildData/WorkspaceBuildData" ;
26
26
import { WorkspaceBuildLogs } from "modules/workspaces/WorkspaceBuildLogs/WorkspaceBuildLogs" ;
27
- import { HTMLProps , useLayoutEffect , useRef , type FC } from "react" ;
27
+ import {
28
+ type CSSProperties ,
29
+ type FC ,
30
+ type HTMLProps ,
31
+ useLayoutEffect ,
32
+ useRef ,
33
+ useState ,
34
+ } from "react" ;
28
35
import { Link } from "react-router-dom" ;
29
36
import { displayWorkspaceBuildDuration } from "utils/workspace" ;
30
37
import { Sidebar , SidebarCaption , SidebarItem } from "./Sidebar" ;
@@ -212,6 +219,7 @@ const ScrollArea: FC<HTMLProps<HTMLDivElement>> = () => {
212
219
// Issue: https://github.com/coder/coder/issues/9687
213
220
// Reference: https://stackoverflow.com/questions/43381836/height100-works-in-chrome-but-not-in-safari
214
221
const contentRef = useRef < HTMLDivElement > ( null ) ;
222
+ const [ height , setHeight ] = useState < CSSProperties [ "width" ] > ( "100%" ) ;
215
223
useLayoutEffect ( ( ) => {
216
224
const contentEl = contentRef . current ;
217
225
if ( ! contentEl ) {
@@ -223,7 +231,7 @@ const ScrollArea: FC<HTMLProps<HTMLDivElement>> = () => {
223
231
if ( ! parentEl ) {
224
232
return ;
225
233
}
226
- contentEl . style . setProperty ( "height" , ` ${ parentEl . clientHeight } px` ) ;
234
+ setHeight ( parentEl . clientHeight ) ;
227
235
} ) ;
228
236
resizeObserver . observe ( document . body ) ;
229
237
@@ -233,10 +241,7 @@ const ScrollArea: FC<HTMLProps<HTMLDivElement>> = () => {
233
241
} , [ ] ) ;
234
242
235
243
return (
236
- < div
237
- ref = { contentRef }
238
- css = { { height : "100%" , overflowY : "auto" , width : "100%" } }
239
- />
244
+ < div ref = { contentRef } css = { { height, overflowY : "auto" , width : "100%" } } />
240
245
) ;
241
246
} ;
242
247
0 commit comments