From 6cd8725a7b4eda78086c52843105a64c2ed4672e Mon Sep 17 00:00:00 2001 From: Yan-Ying Liao Date: Sat, 10 Aug 2024 22:39:42 +0200 Subject: [PATCH] Delete unused states --- src/app/components/GraphViewer.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/app/components/GraphViewer.tsx b/src/app/components/GraphViewer.tsx index 4f12c19..d147897 100644 --- a/src/app/components/GraphViewer.tsx +++ b/src/app/components/GraphViewer.tsx @@ -108,8 +108,7 @@ const GraphViewer: React.FC = ({ const [apiSearchResults, setApiSearchResults] = useState( null ); - const [loading, setLoading] = useState(false); - const [error, setError] = useState(null); + const [graphData, setGraphData] = useState(data); const initialGraphData = useRef(data); @@ -127,8 +126,6 @@ const GraphViewer: React.FC = ({ query: string, searchType: "local" | "global" ) => { - setLoading(true); - setError(null); try { const data: SearchResult = searchType === "local" @@ -140,9 +137,7 @@ const GraphViewer: React.FC = ({ updateGraphData(data.context_data); } catch (err) { console.error("An error occurred during the API search.", err); - setError("An error occurred during the API search."); } finally { - setLoading(false); } };