Register handlers before sending message

This commit is contained in:
Luo Tim 2024-05-23 22:55:43 +08:00
parent aec4216856
commit 270b55e5de

View File

@ -89,7 +89,6 @@ const chatPanel = observer(() => {
if (!router.currentRoute || router.currentRoute !== "chat") {return;}
// Fetch the command menus, before history records are obtained,
// because the display information in the history record requires adjustment
messageUtil.sendMessage({ command: "regCommandList" });
messageUtil.registerHandler(
"regCommandList",
(message: { result: WorkflowItem[] }) => {
@ -157,6 +156,8 @@ const chatPanel = observer(() => {
}
);
messageUtil.sendMessage({ command: "regCommandList" });
timer.start();
return () => {
timer.clear();