Skip to content

Commit 2c19204

Browse files
committed
docs: Load post faster
1 parent 39471f5 commit 2c19204

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

website/src/components/Playground/Preview.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function Preview<T>({
7575
[styles.hidden]: hiddenResult,
7676
})}
7777
>
78-
<Boundary fallback={<LivePreviewLoader />}>
78+
<Boundary fallback={null}>
7979
<PreviewBlockLazy />
8080
</Boundary>
8181
</div>
@@ -86,9 +86,6 @@ function Preview<T>({
8686
}
8787
export default memo(Preview);
8888

89-
function LivePreviewLoader() {
90-
return <div>Loading...</div>;
91-
}
9289
const PreviewBlockLazy = lazy(
9390
() =>
9491
import(
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import React from 'react';
22
import { LiveError, LivePreview } from 'react-live';
33

4+
import Boundary from './Boundary';
45
import styles from './styles.module.css';
56

67
export default function PreviewBlock() {
78
return (
89
<>
9-
<LivePreview />
10+
<Boundary fallback={<LivePreviewLoader />}>
11+
<LivePreview />
12+
</Boundary>
1013
<LiveError className={styles.playgroundError} />
1114
</>
1215
);
1316
}
17+
function LivePreviewLoader() {
18+
return <div>Loading...</div>;
19+
}

website/src/fixtures/posts.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ const entities = {
9090

9191
export const getInitialInterceptorData = () => ({ entities: {} });
9292

93-
const delay = 150;
94-
9593
export const postFixtures = [
9694
{
9795
endpoint: PostResource.get,
@@ -102,7 +100,6 @@ export const postFixtures = [
102100
...entities[id],
103101
};
104102
},
105-
delay,
106103
},
107104
{
108105
endpoint: PostResource.getList,
@@ -114,7 +111,6 @@ export const postFixtures = [
114111
}
115112
return Object.values(entities);
116113
},
117-
delay,
118114
},
119115
{
120116
endpoint: PostResource.vote,

0 commit comments

Comments
 (0)