Lazy load some components that aren't needed at load. For #2167

This commit is contained in:
Gabe Kangas
2022-10-03 21:06:46 -07:00
parent 4a999a39b2
commit b1484f4c9f
4 changed files with 51 additions and 11 deletions

View File

@@ -9,16 +9,25 @@ import {
import { useRecoilState, useRecoilValue } from 'recoil';
import { FC, useState } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import { Modal } from '../../ui/Modal/Modal';
import dynamic from 'next/dynamic';
import {
chatVisibleToggleAtom,
chatDisplayNameAtom,
appStateAtom,
} from '../../stores/ClientConfigStore';
import styles from './UserDropdown.module.scss';
import { NameChangeModal } from '../../modals/NameChangeModal/NameChangeModal';
import { AppStateOptions } from '../../stores/application-state';
import { AuthModal } from '../../modals/AuthModal/AuthModal';
// Lazy loaded components
const Modal = dynamic(() => import('../../ui/Modal/Modal').then(mod => mod.Modal));
const NameChangeModal = dynamic(() =>
import('../../modals/NameChangeModal/NameChangeModal').then(mod => mod.NameChangeModal),
);
const AuthModal = dynamic(() =>
import('../../modals/AuthModal/AuthModal').then(mod => mod.AuthModal),
);
export type UserDropdownProps = {
username?: string;