Skip to content

Commit 379f748

Browse files
P0lipbilliegoose
andauthored
fix(code-viewer): remove Suspense (#190)
* feat(code-viewer): remove Suspense * chore: rename things so diff is reasonable * chore: adjust exports so it's not a breaking change * chore: actually lets not even rename index.tsx to index.ts Co-authored-by: William Hilton <wmhilton@gmail.com>
1 parent 9772e38 commit 379f748

2 files changed

Lines changed: 2 additions & 24 deletions

File tree

src/CodeViewer/__tests__/Viewer.spec.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ import { parseCode } from '../utils/parseCode';
1010
jest.mock('../utils/astToReact');
1111
jest.mock('../utils/parseCode');
1212

13-
jest.mock('../components/BlockCodeViewer', () => ({
14-
BlockCodeViewer: jest.requireActual('../components/BlockCodeViewer/BlockCodeViewer').default,
15-
}));
16-
1713
jest.mock('../components/BlockCodeViewer/ObservableSet', () => ({
1814
ObservableSet: class extends Set {
1915
public readonly addListener = jest.fn().mockImplementation((node, listener) => {
Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,2 @@
1-
import * as React from 'react';
2-
3-
import { FAIcon } from '../../../FAIcon';
4-
import type { IBlockCodeViewerProps } from './BlockCodeViewer';
5-
6-
const BlockCodeViewerComponent = React.lazy(() => import('./BlockCodeViewer'));
7-
8-
export const BlockCodeViewer: React.FC<IBlockCodeViewerProps> = props => (
9-
<React.Suspense fallback={<CodeViewerLoading />}>
10-
<BlockCodeViewerComponent {...props} />
11-
</React.Suspense>
12-
);
13-
14-
const CodeViewerLoading = () => (
15-
<div>
16-
Preparing... <FAIcon icon={['fas', 'code']} size="lg" />
17-
</div>
18-
);
19-
20-
export { IBlockCodeViewerProps };
1+
export type { IBlockCodeViewerProps } from './BlockCodeViewer';
2+
export { default as BlockCodeViewer } from './BlockCodeViewer';

0 commit comments

Comments
 (0)