Skip to content

Commit

Permalink
docs: Load post faster
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Jun 23, 2024
1 parent 39471f5 commit 2c19204
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 1 addition & 4 deletions website/src/components/Playground/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function Preview<T>({
[styles.hidden]: hiddenResult,
})}
>
<Boundary fallback={<LivePreviewLoader />}>
<Boundary fallback={null}>
<PreviewBlockLazy />
</Boundary>
</div>
Expand All @@ -86,9 +86,6 @@ function Preview<T>({
}
export default memo(Preview);

function LivePreviewLoader() {
return <div>Loading...</div>;
}
const PreviewBlockLazy = lazy(
() =>
import(
Expand Down
8 changes: 7 additions & 1 deletion website/src/components/Playground/PreviewBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import React from 'react';
import { LiveError, LivePreview } from 'react-live';

import Boundary from './Boundary';
import styles from './styles.module.css';

export default function PreviewBlock() {
return (
<>
<LivePreview />
<Boundary fallback={<LivePreviewLoader />}>
<LivePreview />
</Boundary>
<LiveError className={styles.playgroundError} />
</>
);
}
function LivePreviewLoader() {
return <div>Loading...</div>;
}
4 changes: 0 additions & 4 deletions website/src/fixtures/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ const entities = {

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

const delay = 150;

export const postFixtures = [
{
endpoint: PostResource.get,
Expand All @@ -102,7 +100,6 @@ export const postFixtures = [
...entities[id],
};
},
delay,
},
{
endpoint: PostResource.getList,
Expand All @@ -114,7 +111,6 @@ export const postFixtures = [
}
return Object.values(entities);
},
delay,
},
{
endpoint: PostResource.vote,
Expand Down

0 comments on commit 2c19204

Please sign in to comment.