fix(CodeToolbar): correct tool cleanup and fix callback invocation

Ensure the correct tool ID is used for cleanup and wrap fixCode in arrow function to maintain context
This commit is contained in:
icarus 2025-10-22 06:22:58 +08:00
parent 55b63d345e
commit 63e522bf82

View File

@ -169,10 +169,10 @@ export const useMermaidFixTool = ({ enabled, context, onSave, setError, setTools
icon: <WrenchIcon size={'1rem'} className="tool-icon" />,
tooltip: t('code_block.mermaid_fix.label'),
visible: () => error !== undefined && error !== null,
onClick: fixCode
onClick: () => fixCode()
})
}
return () => removeTool(TOOL_SPECS.expand.id)
return () => removeTool(TOOL_SPECS.mermaid_fix.id)
}, [enabled, error, fixCode, registerTool, removeTool, t])
}