Skip to content

Commit 4ea3f55

Browse files
committed
fix: hide preview container when previews: false
1 parent f33082f commit 4ea3f55

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/astro/src/default/pages/[...slug].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ meta.description ??= 'A TutorialKit interactive lesson';
2424

2525
<Layout title={title} meta={meta}>
2626
<PageLoadingIndicator />
27-
<div id="previews-container"></div>
27+
<div id="previews-container" style="display: none;"></div>
2828
<main class="max-w-full flex flex-col h-full overflow-hidden" data-swap-root>
2929
<TopBarWrapper logoLink={logoLink ?? '/'} openInStackBlitz={lesson.data.openInStackBlitz} />
3030
<MainContainer lesson={lesson} navList={navList} />

packages/react/src/Panels/PreviewPanel.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@ export const PreviewPanel = memo(
6262
useEffect(() => {
6363
// we update the iframes position at max fps if we have any
6464
if (hasPreviews) {
65-
return requestAnimationFrameLoop(onResize);
65+
const cancel = requestAnimationFrameLoop(onResize);
66+
67+
previewsContainer.style.display = 'block';
68+
69+
return () => {
70+
previewsContainer.style.display = 'none';
71+
cancel();
72+
};
6673
}
6774

6875
return undefined;

0 commit comments

Comments
 (0)