Skip to content

Commit

Permalink
chore(website): Fix 404 page for sandboxes
Browse files Browse the repository at this point in the history
Also removed the list of available sandboxes
  • Loading branch information
mlaursen committed Mar 9, 2022
1 parent 1a59190 commit 4772c88
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 115 deletions.
32 changes: 14 additions & 18 deletions packages/documentation/src/components/DemoSandbox/DemoSandbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import NotFoundPage from "components/NotFoundPage";
import { useTheme } from "components/Theme";
import { parseSandbox, SandboxQuery } from "utils/routes";

import SandboxList from "./SandboxList";
import SandboxModal from "./SandboxModal";
import useSandbox from "./useSandbox";
import useFiles from "./useFiles";
Expand Down Expand Up @@ -75,8 +74,8 @@ export default function DemoSandbox({
[folders, router, pkg, name, from, fileName]
);

if (!sandbox && !loading && (pkg || name || from)) {
if (process.env.NODE_ENV !== "production") {
if (!sandbox && !loading) {
if (process.env.NODE_ENV !== "production" && (pkg || name || from)) {
throw new Error(
"No sandbox found. Run `yarn sandbox` to generate demo sandboxes."
);
Expand All @@ -86,20 +85,17 @@ export default function DemoSandbox({
}

return (
<>
<SandboxList />
<SandboxModal
pkg={pkg}
name={name}
fileName={fileName}
from={from}
files={files}
loading={loading}
folders={folders}
sandbox={sandbox}
onFileChange={onFileChange}
onRequestClose={onRequestClose}
/>
</>
<SandboxModal
pkg={pkg}
name={name}
fileName={fileName}
from={from}
files={files}
loading={loading}
folders={folders}
sandbox={sandbox}
onFileChange={onFileChange}
onRequestClose={onRequestClose}
/>
);
}

This file was deleted.

72 changes: 0 additions & 72 deletions packages/documentation/src/components/DemoSandbox/SandboxList.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function useSandbox(
{ js, pkg, name, theme, pathname }: SandboxQuery
): ReturnValue {
const [sandbox, setSandbox] = useState(defaultSandbox);
const [isLoading, setLoading] = useState(!sandbox);
const [isLoading, setLoading] = useState(false);
const prevJs = useRef(js);
const loading = isLoading || prevJs.current !== js;

Expand Down

0 comments on commit 4772c88

Please sign in to comment.