Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: don't allow double register two ai nodes

Richard Shiuedeb019aa4a5b
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/operations/ai_writer_cubit.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/operations/ai_writer_cubit.dart
index 3521c2c63d..3b0e04e828 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/operations/ai_writer_cubit.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/ai/operations/ai_writer_cubit.dart
@@ -51,6 +51,10 @@ class AiWriterCubit extends Cubit<AiWriterState> {
}
void register(Node node) async {
+ if (aiWriterNode != null && node.id != aiWriterNode!.id) {
+ await removeAiWriterNode(editorState, node);
+ return;
+ }
aiWriterNode = node;
onCreateNode?.call();