diff --git a/apps/client/src/features/page/components/page-import-modal.tsx b/apps/client/src/features/page/components/page-import-modal.tsx index 0223d78f..a2df380e 100644 --- a/apps/client/src/features/page/components/page-import-modal.tsx +++ b/apps/client/src/features/page/components/page-import-modal.tsx @@ -24,7 +24,7 @@ import { treeDataAtom } from "@/features/page/tree/atoms/tree-data-atom.ts"; import { useAtom } from "jotai"; import { buildTree } from "@/features/page/tree/utils"; import { IPage } from "@/features/page/types/page.types.ts"; -import React, { useEffect, useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { ConfluenceIcon } from "@/components/icons/confluence-icon.tsx"; import { getFileImportSizeLimit, isCloud } from "@/lib/config.ts"; @@ -84,6 +84,12 @@ function ImportFormatSelection({ spaceId, onClose }: ImportFormatSelection) { const [fileTaskId, setFileTaskId] = useState(null); const emit = useQueryEmit(); + const markdownFileRef = useRef<() => void>(null); + const htmlFileRef = useRef<() => void>(null); + const notionFileRef = useRef<() => void>(null); + const confluenceFileRef = useRef<() => void>(null); + const zipFileRef = useRef<() => void>(null); + const canUseConfluence = isCloud() || workspace?.hasLicenseKey; const handleZipUpload = async (selectedFile: File, source: string) => { @@ -116,6 +122,15 @@ function ImportFormatSelection({ spaceId, onClose }: ImportFormatSelection) { }); setFileTaskId(importTask.id); + + // Reset file input after successful upload + if (source === "notion" && notionFileRef.current) { + notionFileRef.current(); + } else if (source === "confluence" && confluenceFileRef.current) { + confluenceFileRef.current(); + } else if (source === "generic" && zipFileRef.current) { + zipFileRef.current(); + } } catch (err) { console.log("Failed to upload import file", err); notifications.update({ @@ -243,6 +258,10 @@ function ImportFormatSelection({ spaceId, onClose }: ImportFormatSelection) { setTreeData(fullTree); } + // Reset file inputs after successful upload + if (markdownFileRef.current) markdownFileRef.current(); + if (htmlFileRef.current) htmlFileRef.current(); + const pageCountText = pageCount === 1 ? `1 ${t("page")}` : `${pageCount} ${t("pages")}`; @@ -272,7 +291,7 @@ function ImportFormatSelection({ spaceId, onClose }: ImportFormatSelection) { return ( <> - + {(props) => (