Skip to content

Commit

Permalink
fix: don't have client repl code in server
Browse files Browse the repository at this point in the history
  • Loading branch information
wmertens committed Mar 3, 2024
1 parent 4d8c3d2 commit 9f40d14
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/docs/src/repl/repl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ReplDetailPanel } from './repl-detail-panel';
import { getReplVersion } from './repl-version';
import { updateReplOutput } from './repl-output-update';
import { QWIK_PKG_NAME, bundled, getNpmCdnUrl } from './bundled';
import { isServer } from '@builder.io/qwik/build';

export const Repl = component$((props: ReplProps) => {
useStyles$(styles);
Expand Down Expand Up @@ -79,6 +80,9 @@ export const Repl = component$((props: ReplProps) => {

useVisibleTask$(
async () => {
if (isServer) {
return;
}
// only run on the client
// Get the version asap, most likely it will be cached.
const v = await getReplVersion(input.version, true);
Expand Down Expand Up @@ -132,6 +136,9 @@ export const receiveMessageFromReplServer = (
store: ReplStore,
input: ReplAppInput
) => {
if (isServer) {
return;
}
if (ev.origin !== window.origin) {
return;
}
Expand Down Expand Up @@ -175,6 +182,9 @@ const getDependencies = (input: ReplAppInput) => {
};

export const sendUserUpdateToReplServer = (input: ReplAppInput, store: ReplStore) => {
if (isServer) {
return;
}
if (input.version && store.serverWindow) {
const msg: ReplUpdateMessage = {
type: 'update',
Expand Down

0 comments on commit 9f40d14

Please sign in to comment.