diff --git a/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx b/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx index 2f694b31..88407aa0 100644 --- a/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx +++ b/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx @@ -75,7 +75,7 @@ export function AlignmentsTab() { return counts; }, [alignments]); - const handleSave = async () => { + const handleSave = useCallback(async () => { if (!sourceUri.trim() || !targetUri.trim()) { setError("Provide both source and target entity URIs."); return; @@ -100,9 +100,9 @@ export function AlignmentsTab() { } finally { setBusy(false); } - }; + }, [sourceUri, targetUri, relation, confidence, provenance, source, reviewer, reload]); - const handleSuggest = async () => { + const handleSuggest = useCallback(async () => { setBusy(true); setError(""); try { @@ -118,17 +118,17 @@ export function AlignmentsTab() { } finally { setBusy(false); } - }; + }, [sourceOntology, targetOntology, threshold]); - const handleAcceptSuggestion = (suggestion: AlignmentSuggestion) => { + const handleAcceptSuggestion = useCallback((suggestion: AlignmentSuggestion) => { setSourceUri(suggestion.source_uri); setTargetUri(suggestion.target_uri); setRelation(suggestion.relation); setConfidence(Math.max(0.1, Math.min(1, suggestion.score))); setProvenance(suggestion.reason); - }; + }, []); - const handleRemove = async (id: string) => { + const handleRemove = useCallback(async (id: string) => { setBusy(true); setError(""); try { @@ -139,7 +139,7 @@ export function AlignmentsTab() { } finally { setBusy(false); } - }; + }, [reload]); return (