diff --git a/packages/doceditor/src/app/(root)/create/page.tsx b/packages/doceditor/src/app/(root)/create/page.tsx index 4bbf3af410..4a5ab030f2 100644 --- a/packages/doceditor/src/app/(root)/create/page.tsx +++ b/packages/doceditor/src/app/(root)/create/page.tsx @@ -25,13 +25,19 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode import { permanentRedirect, redirect } from "next/navigation"; +import dynamic from "next/dynamic"; import { getBaseUrl } from "@docspace/shared/utils/next-ssr-helper"; +import { EditorConfigErrorType } from "@docspace/shared/enums"; import { createFile, fileCopyAs, getEditorUrl } from "@/utils/actions"; -import CreateFileError from "@/components/CreateFileError"; -import Editor from "@/components/Editor"; -import { EditorConfigErrorType } from "@docspace/shared/enums"; + +const Editor = dynamic(() => import("@/components/Editor"), { + ssr: false, +}); +const CreateFileError = dynamic(() => import("@/components/CreateFileError"), { + ssr: false, +}); type TSearchParams = { parentId: string; diff --git a/packages/doceditor/src/app/(root)/page.tsx b/packages/doceditor/src/app/(root)/page.tsx index 553af8bbe3..19d93efbf6 100644 --- a/packages/doceditor/src/app/(root)/page.tsx +++ b/packages/doceditor/src/app/(root)/page.tsx @@ -26,6 +26,7 @@ import { headers } from "next/headers"; import Script from "next/script"; +import dynamic from "next/dynamic"; import { getSelectorsByUserAgent } from "react-device-detect"; @@ -34,7 +35,10 @@ import { ValidationStatus } from "@docspace/shared/enums"; import { getData, validatePublicRoomKey } from "@/utils/actions"; import { RootPageProps } from "@/types"; import Root from "@/components/Root"; -import FilePassword from "@/components/file-password"; + +const FilePassword = dynamic(() => import("@/components/file-password"), { + ssr: false, +}); const initialSearchParams: RootPageProps["searchParams"] = { fileId: undefined, diff --git a/packages/doceditor/src/components/Editor.tsx b/packages/doceditor/src/components/Editor.tsx index 06eb9976b8..13cfadd646 100644 --- a/packages/doceditor/src/components/Editor.tsx +++ b/packages/doceditor/src/components/Editor.tsx @@ -27,7 +27,7 @@ "use client"; import React from "react"; -import { useRouter, useSearchParams } from "next/navigation"; +import { useSearchParams } from "next/navigation"; import { useTranslation } from "react-i18next"; import { DocumentEditor } from "@onlyoffice/document-editor-react"; @@ -88,7 +88,6 @@ const Editor = ({ }: EditorProps) => { const { t, i18n } = useTranslation(["Common", "Editor", "DeepLink"]); - const router = useRouter(); const searchParams = useSearchParams(); const { filesSettings } = useFilesSettings({}); diff --git a/packages/doceditor/src/components/Root.tsx b/packages/doceditor/src/components/Root.tsx index b2aadac2c9..0754746f47 100644 --- a/packages/doceditor/src/components/Root.tsx +++ b/packages/doceditor/src/components/Root.tsx @@ -25,11 +25,17 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode "use client"; +import dynamic from "next/dynamic"; import React from "react"; import { useTranslation } from "react-i18next"; -import ErrorContainer from "@docspace/shared/components/error-container/ErrorContainer"; +const ErrorContainer = dynamic( + () => import("@docspace/shared/components/error-container/ErrorContainer"), + { + ssr: false, + }, +); import { TResponse } from "@/types"; @@ -44,15 +50,31 @@ import useFilesSettings from "@/hooks/useFilesSettings"; import useUpdateSearchParamId from "@/hooks/useUpdateSearchParamId"; import useStartFillingSelectDialog from "@/hooks/useStartFillingSelectDialog"; -import DeepLink from "./deep-link"; import Editor from "./Editor"; -import SelectFileDialog from "./SelectFileDialog"; -import SelectFolderDialog from "./SelectFolderDialog"; -import SharingDialog from "./ShareDialog"; +const DeepLink = dynamic(() => import("./deep-link"), { + ssr: false, +}); +const SelectFileDialog = dynamic(() => import("./SelectFileDialog"), { + ssr: false, +}); +const SelectFolderDialog = dynamic(() => import("./SelectFolderDialog"), { + ssr: false, +}); +const SharingDialog = dynamic(() => import("./ShareDialog"), { + ssr: false, +}); +const StartFillingSelectorDialog = dynamic( + () => import("./StartFillingSelectDialog"), + { + ssr: false, + }, +); +const ConflictResolveDialog = dynamic(() => import("./ConflictResolveDialog"), { + ssr: false, +}); + import { calculateAsideHeight } from "@/utils"; -import StartFillingSelectorDialog from "./StartFillingSelectDialog"; -import ConflictResolveDialog from "./ConflictResolveDialog"; const Root = ({ settings,