Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(web): only close rename modal after a successful save (#20940)

chanx7887a144fe42
diff --git a/web/src/pages/memories/hooks.ts b/web/src/pages/memories/hooks.ts
index 6db05059f8..c17f20b93b 100644
--- a/web/src/pages/memories/hooks.ts
+++ b/web/src/pages/memories/hooks.ts
@@ -323,6 +323,7 @@ export const useRenameMemory = () => {
const onMemoryRenameOk = useCallback(
async (data: ICreateMemoryProps, callBack?: () => void) => {
+ let res;
if (memory?.id) {
try {
await updateMemory({
@@ -334,13 +335,15 @@ export const useRenameMemory = () => {
console.error('error', e);
}
} else {
- await createMemory(data);
+ res = await createMemory(data);
}
// if (res && !memory?.id) {
// navigateToMemory(res?.id)();
// }
- callBack?.();
- handleHideModal();
+ if (res) {
+ callBack?.();
+ handleHideModal();
+ }
},
[memory, createMemory, handleHideModal, updateMemory],
);
diff --git a/web/src/pages/next-searches/hooks.ts b/web/src/pages/next-searches/hooks.ts
index 4797d73379..b49881b867 100644
--- a/web/src/pages/next-searches/hooks.ts
+++ b/web/src/pages/next-searches/hooks.ts
@@ -398,9 +398,11 @@ export const useRenameSearch = () => {
if (res && !search?.id) {
navigateToSearch(res?.search_id)();
}
- callBack?.();
setLoading(false);
- handleHideModal();
+ if (res) {
+ callBack?.();
+ handleHideModal();
+ }
},
[search, createSearch, handleHideModal, navigateToSearch, updateSearch],
);