Merge pull request #1267 from mvanhorn/osc/1250-isexportingkb-ref

refactor(documents-sidebar): convert discarded isExportingKB state to ref
This commit is contained in:
Rohan Verma 2026-04-20 20:57:07 -07:00 committed by GitHub
commit d744cb48bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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]