Skip to content

Commit 5be7f52

Browse files
committed
Adding isServer to block the loading the editor and guard SSR
1 parent 80693cf commit 5be7f52

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/components/repl.tsx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, Show, For, Suspense, createSignal, createEffect, lazy, batch } from 'solid-js';
2+
import { isServer } from 'solid-js/web';
23
import { Icon } from '@amoutonbrady/solid-heroicons';
34
import { refresh } from '@amoutonbrady/solid-heroicons/outline';
45
import { unwrap, createStore } from 'solid-js/store';
@@ -11,7 +12,6 @@ import { Error } from './error';
1112

1213
import type { Tab } from '../';
1314
import { debounce } from '../utils/debounce';
14-
import { throttle } from '../utils/throttle';
1515
import { formatMs } from '../utils/formatTime';
1616

1717
import MonacoTabs from './monacoTabs';
@@ -426,21 +426,22 @@ export const Repl: Component<ReplProps> = (props) => {
426426
}
427427
>
428428
<MonacoTabs tabs={props.tabs} compiled={store.compiled} />
429-
<Editor
430-
url={`file:///${props.current}`}
431-
onDocChange={handleDocChange}
432-
class="h-full focus:outline-none bg-blueGray-50 dark:bg-blueGray-800 row-start-2"
433-
styles={{ backgroundColor: '#F8FAFC' }}
434-
disabled={!props.interactive}
435-
canCopy
436-
canFormat
437-
formatter={formatter}
438-
isDark={props.dark}
439-
withMinimap={false}
440-
showActionBar={props.actionBar}
441-
ref={props.onEditorReady}
442-
/>
443-
429+
<Show when={!isServer}>
430+
<Editor
431+
url={`file:///${props.current}`}
432+
onDocChange={handleDocChange}
433+
class="h-full focus:outline-none bg-blueGray-50 dark:bg-blueGray-800 row-start-2"
434+
styles={{ backgroundColor: '#F8FAFC' }}
435+
disabled={!props.interactive}
436+
canCopy
437+
canFormat
438+
formatter={formatter}
439+
isDark={props.dark}
440+
withMinimap={false}
441+
showActionBar={props.actionBar}
442+
ref={props.onEditorReady}
443+
/>
444+
</Show>
444445
<GridResizer
445446
ref={(el) => setVerticalResizer(el)}
446447
isHorizontal={props.isHorizontal}
@@ -457,7 +458,7 @@ export const Repl: Component<ReplProps> = (props) => {
457458
onResize={changeLeft}
458459
/>
459460

460-
<Show when={!showPreview()}>
461+
<Show when={!isServer && !showPreview()}>
461462
<section
462463
class="h-full max-h-screen bg-white dark:bg-blueGray-800 grid focus:outline-none row-start-5 relative divide-y-2 divide-blueGray-200 dark:divide-blueGray-500"
463464
classList={{ 'md:row-start-2': !props.isHorizontal }}

0 commit comments

Comments
 (0)