Skip to content

Commit df1073c

Browse files
committed
Fix SSR issue
1 parent 39e1e8a commit df1073c

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

apps/website/docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const config = {
9393
items: [
9494
{
9595
label: "Tutorial",
96-
to: "/docs/intro",
96+
to: "/docs/overview",
9797
},
9898
],
9999
},

apps/website/src/pages/playground.md

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import Playground from "@site/src/components/Playground";
2-
import CoreSwitcher from "@site/src/components/Playground/CoreSwitcher";
3-
import FileSystemManager from
4-
"@site/src/components/Playground/Workspace/FileSystemManager";
5-
import Editor from
6-
"@site/src/components/Playground/Workspace/Editor";
1+
import BrowserOnly from '@docusaurus/BrowserOnly';
72
import MuiThemeProvider from "@site/src/components/common/MuiThemeProvider";
83
import ThemedButton from "@site/src/components/common/ThemedButton";
94
import ThemedIconButton from "@site/src/components/common/ThemedIconButton";
@@ -26,7 +21,12 @@ development!
2621

2722
:::
2823

29-
<Playground />
24+
<BrowserOnly>
25+
{() => {
26+
const Playground = require('@site/src/components/Playground').default;
27+
return <Playground/>
28+
}}
29+
</BrowserOnly>
3030

3131
<div style={{ height: 32 }} />
3232

@@ -48,7 +48,12 @@ The assets are downloaded automatically when you enter the Playground. You can
4848
choose to use multithreading version instead by click on the switch:
4949

5050
<MuiThemeProvider>
51-
<CoreSwitcher />
51+
<BrowserOnly>
52+
{() => {
53+
const CoreSwitcher = require('@site/src/components/Playground/CoreSwitcher').default;
54+
return <CoreSwitcher/>;
55+
}}
56+
</BrowserOnly>
5257
</MuiThemeProvider>
5358

5459
#### Load files to in-memory File System
@@ -58,16 +63,23 @@ System to make sure these files can be consumed by the ffmpeg.wasm APIs:
5863

5964
<div style={{ maxWidth: 260 }}>
6065
<MuiThemeProvider>
61-
<FileSystemManager
62-
nodes={[
63-
{name: "..", isDir: true},
64-
{name: "tmp", isDir: true},
65-
{name: "home", isDir: true},
66-
{name: "dev", isDir: true},
67-
{name: "proc", isDir: true},
68-
{name: "video.avi", isDir: false},
69-
]}
70-
/>
66+
<BrowserOnly>
67+
{() => {
68+
const FileSystemManager = require('@site/src/components/Playground/Workspace/FileSystemManager').default;
69+
return (
70+
<FileSystemManager
71+
nodes={[
72+
{name: "..", isDir: true},
73+
{name: "tmp", isDir: true},
74+
{name: "home", isDir: true},
75+
{name: "dev", isDir: true},
76+
{name: "proc", isDir: true},
77+
{name: "video.avi", isDir: false},
78+
]}
79+
/>
80+
);
81+
}}
82+
</BrowserOnly>
7183
</MuiThemeProvider>
7284
</div>
7385

@@ -92,7 +104,14 @@ and hit <ThemedButton variant="contained">Run</ThemedButton> afterward:
92104

93105
<div style={{ maxWidth: 480 }}>
94106
<MuiThemeProvider>
95-
<Editor args={JSON.stringify(["-i", "video.avi", "video.mp4"], null, 2)} />
107+
<BrowserOnly>
108+
{() => {
109+
const Editor = require('@site/src/components/Playground/Workspace/Editor').default;
110+
return (
111+
<Editor args={JSON.stringify(["-i", "video.avi", "video.mp4"], null, 2)} />
112+
);
113+
}}
114+
</BrowserOnly>
96115
</MuiThemeProvider>
97116
</div>
98117

0 commit comments

Comments
 (0)