Fix some React lifecycle and rendering errors that exist in build

This commit is contained in:
Gabe Kangas
2023-01-10 16:39:12 -08:00
parent e9d43492d0
commit d8a5380b7f
16 changed files with 85 additions and 102 deletions

View File

@@ -149,7 +149,7 @@ const MobileContent = ({
supportsBrowserNotifications,
}) => {
if (!currentUser) {
return null;
return <Skeleton loading active paragraph={{ rows: 7 }} />;
}
const { id, displayName } = currentUser;

View File

@@ -1,4 +1,4 @@
import { Tag } from 'antd';
import { Tag, Tooltip } from 'antd';
import { FC } from 'react';
import cn from 'classnames';
import dynamic from 'next/dynamic';
@@ -7,14 +7,13 @@ import styles from './Header.module.scss';
// Lazy loaded components
const UserDropdown = dynamic(() =>
import('../../common/UserDropdown/UserDropdown').then(mod => mod.UserDropdown),
const UserDropdown = dynamic(
() => import('../../common/UserDropdown/UserDropdown').then(mod => mod.UserDropdown),
{
ssr: false,
},
);
const Tooltip = dynamic(() => import('antd').then(mod => mod.Tooltip), {
ssr: false,
});
export type HeaderComponentProps = {
name: string;
chatAvailable: boolean;

View File

@@ -8,16 +8,18 @@ import styles from './Sidebar.module.scss';
import { currentUserAtom, visibleChatMessagesSelector } from '../../stores/ClientConfigStore';
// Lazy loaded components
const ChatContainer = dynamic(() =>
import('../../chat/ChatContainer/ChatContainer').then(mod => mod.ChatContainer),
const ChatContainer = dynamic(
() => import('../../chat/ChatContainer/ChatContainer').then(mod => mod.ChatContainer),
{
ssr: false,
},
);
export const Sidebar: FC = () => {
const currentUser = useRecoilValue(currentUserAtom);
const messages = useRecoilValue<ChatMessage[]>(visibleChatMessagesSelector);
if (!currentUser) {
return null;
return <Sider className={styles.root} collapsedWidth={0} width={320} />;
}
const { id, isModerator, displayName } = currentUser;