fix(notebook): 来源搜索导入后立刻显示占位卡并刷新来源列表

- handleImport 成功后调用 onUploadComplete 通知父组件(原先缺失)并关闭弹窗
- 新增 pendingImportTitles state,同步导入后立刻渲染 PendingSourceCard
- sources 刷新后按标题匹配移除占位卡并自动选中新来源

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
xuhdandClaude Sonnet 4.6 committed 2026-06-24 13:14:36 +08:00
1 parent b1ef4ccb1a
commit 85cd2c888e
2 files changed
+45 -14

No files matched your search

@@ -405,8 +405,15 @@ const DocumentUploadPopupContent: FC<{
if (response.ok) {
const data = await response.json() as { imported_count?: number };
toast.success(`成功导入 ${data.imported_count || dataList.length} 个来源`);
setListData([]);
handleBatchDelete();
onUploadComplete?.(
selectedSearchSources.map((s) => ({
id: undefined,
title: s.title,
task_id: undefined,
status: "success" as const,
}))
);
onOpenChange(false);
} else {
const errorData = await response.json() as { detail?: string };
toast.error(errorData.detail || "导入失败,请重试");