Skip to content

Commit 5aad845

Browse files
committed
webR App: Fix plot height on initial layout
1 parent 93c29c9 commit 5aad845

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/repl/components/Plot.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ export function Plot({
7272
});
7373
}, []);
7474

75+
// Set initial plot height
76+
React.useLayoutEffect(() => {
77+
void webR.init().then(() => {
78+
if (!panelRef.current) return;
79+
onResize(panelRef.current.getSize());
80+
});
81+
}, []);
82+
7583
// Update the plot container to display the currently selected canvas element
7684
React.useEffect(() => {
7785
if (!plotContainerRef.current) {

0 commit comments

Comments
 (0)