mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-27 12:51:26 +08:00
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
This commit is contained in:
parent
63e522bf82
commit
d2b25af146
@ -199,6 +199,8 @@ const Messages: React.FC<MessagesProps> = ({ 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 }) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user