lbry-desktop/ui/component/channelDiscussion/view.jsx
infinite-persistence ef0329e03b Lazy-load comment components
## Issue
~300KB savings in `ui.js` size (production, uncompressed). Mostly coming from the emoji library.

## Notes
Most of the `Comment*` components are under `CommentsList` or `LivestreamComments`, so deferring these 2 covered most of it. The exceptions are Notification and OwnComments.
2021-11-11 15:09:28 -05:00

29 lines
800 B
JavaScript

// @flow
import React from 'react';
import Empty from 'component/common/empty';
import { lazyImport } from 'util/lazyImport';
const CommentsList = lazyImport(() => import('component/commentsList' /* webpackChunkName: "comments" */));
type Props = {
uri: string,
linkedCommentId?: string,
commentsDisabled: boolean,
};
function ChannelDiscussion(props: Props) {
const { uri, linkedCommentId, commentsDisabled } = props;
if (commentsDisabled) {
return <Empty text={__('This channel has disabled comments on their page.')} />;
}
return (
<section className="section">
<React.Suspense fallback={null}>
<CommentsList uri={uri} linkedCommentId={linkedCommentId} commentsAreExpanded />
</React.Suspense>
</section>
);
}
export default ChannelDiscussion;