mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-24 16:26:32 +02:00
refactor(documents-sidebar): convert discarded isExportingKB state to ref
Closes #1250
This commit is contained in:
parent
2b2453e015
commit
c2e52fbb48
1 changed files with 5 additions and 5 deletions
|
|
@ -478,7 +478,7 @@ function AuthenticatedDocumentsSidebar({
|
|||
setFolderPickerOpen(true);
|
||||
}, []);
|
||||
|
||||
const [, setIsExportingKB] = useState(false);
|
||||
const isExportingKBRef = useRef(false);
|
||||
const [exportWarningOpen, setExportWarningOpen] = useState(false);
|
||||
const [exportWarningContext, setExportWarningContext] = useState<{
|
||||
folder: FolderDisplay;
|
||||
|
|
@ -508,7 +508,7 @@ function AuthenticatedDocumentsSidebar({
|
|||
const ctx = exportWarningContext;
|
||||
if (!ctx?.folder) return;
|
||||
|
||||
setIsExportingKB(true);
|
||||
isExportingKBRef.current = true;
|
||||
try {
|
||||
const safeName =
|
||||
ctx.folder.name
|
||||
|
|
@ -524,7 +524,7 @@ function AuthenticatedDocumentsSidebar({
|
|||
console.error("Folder export failed:", err);
|
||||
toast.error(err instanceof Error ? err.message : "Export failed");
|
||||
} finally {
|
||||
setIsExportingKB(false);
|
||||
isExportingKBRef.current = false;
|
||||
}
|
||||
setExportWarningContext(null);
|
||||
}, [exportWarningContext, searchSpaceId, doExport]);
|
||||
|
|
@ -560,7 +560,7 @@ function AuthenticatedDocumentsSidebar({
|
|||
return;
|
||||
}
|
||||
|
||||
setIsExportingKB(true);
|
||||
isExportingKBRef.current = true;
|
||||
try {
|
||||
const safeName =
|
||||
folder.name
|
||||
|
|
@ -576,7 +576,7 @@ function AuthenticatedDocumentsSidebar({
|
|||
console.error("Folder export failed:", err);
|
||||
toast.error(err instanceof Error ? err.message : "Export failed");
|
||||
} finally {
|
||||
setIsExportingKB(false);
|
||||
isExportingKBRef.current = false;
|
||||
}
|
||||
},
|
||||
[searchSpaceId, getPendingCountInSubtree, doExport]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue