From d2b25af146023913d60286bde0571277c6d709cc Mon Sep 17 00:00:00 2001 From: icarus Date: Wed, 22 Oct 2025 06:28:41 +0800 Subject: [PATCH] refactor(Messages): add TODO for extracting event processing logic Move event processing function to a reusable hook to improve code reuse and enable promise-based completion tracking --- src/renderer/src/pages/home/Messages/Messages.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/renderer/src/pages/home/Messages/Messages.tsx b/src/renderer/src/pages/home/Messages/Messages.tsx index f37e829a2a..2f0eaf07ed 100644 --- a/src/renderer/src/pages/home/Messages/Messages.tsx +++ b/src/renderer/src/pages/home/Messages/Messages.tsx @@ -199,6 +199,8 @@ const Messages: React.FC = ({ assistant, topic, setActiveTopic, o window.toast.error(t('message.branch.error')) // Example error message } }), + // TODO: We should move this processing function out of the component and turn it into a Hook, so that other components can reuse this function. + // The current implementation prevents the party emitting the event from knowing the completion status of the asynchronous function through a promise. EventEmitter.on( EVENT_NAMES.EDIT_CODE_BLOCK, async (data: { msgBlockId: string; codeBlockId: string; newContent: string }) => {