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