Просмотр исходного кода

dynamic import from react-toastify

Yuki Takei 1 год назад
Родитель
Сommit
c944477abc
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      apps/app/src/components/Layout/RawLayout.tsx

+ 4 - 2
apps/app/src/components/Layout/RawLayout.tsx

@@ -2,14 +2,13 @@ import type { ReactNode } from 'react';
 import React, { useState } from 'react';
 import React, { useState } from 'react';
 
 
 import type { ColorScheme } from '@growi/core';
 import type { ColorScheme } from '@growi/core';
+import dynamic from 'next/dynamic';
 import Head from 'next/head';
 import Head from 'next/head';
-import { ToastContainer } from 'react-toastify';
 import { useIsomorphicLayoutEffect } from 'usehooks-ts';
 import { useIsomorphicLayoutEffect } from 'usehooks-ts';
 
 
 import { useNextThemes, NextThemesProvider } from '~/stores/use-next-themes';
 import { useNextThemes, NextThemesProvider } from '~/stores/use-next-themes';
 import loggerFactory from '~/utils/logger';
 import loggerFactory from '~/utils/logger';
 
 
-
 import styles from './RawLayout.module.scss';
 import styles from './RawLayout.module.scss';
 
 
 const toastContainerClass = styles['grw-toast-container'] ?? '';
 const toastContainerClass = styles['grw-toast-container'] ?? '';
@@ -17,6 +16,9 @@ const toastContainerClass = styles['grw-toast-container'] ?? '';
 const logger = loggerFactory('growi:cli:RawLayout');
 const logger = loggerFactory('growi:cli:RawLayout');
 
 
 
 
+const ToastContainer = dynamic(() => import('react-toastify').then(mod => mod.ToastContainer), { ssr: false });
+
+
 type Props = {
 type Props = {
   className?: string,
   className?: string,
   children?: ReactNode,
   children?: ReactNode,