From fca3ea5d20bcba285ea676a487c092e8749f2ccc Mon Sep 17 00:00:00 2001 From: yangdx Date: Mon, 22 Sep 2025 03:29:17 +0800 Subject: [PATCH] Fix linting --- lightrag_webui/src/components/graph/GraphControl.tsx | 4 ++-- lightrag_webui/src/components/graph/GraphSearch.tsx | 10 +++++----- lightrag_webui/src/features/GraphViewer.tsx | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lightrag_webui/src/components/graph/GraphControl.tsx b/lightrag_webui/src/components/graph/GraphControl.tsx index e4e0a96a..20d6d603 100644 --- a/lightrag_webui/src/components/graph/GraphControl.tsx +++ b/lightrag_webui/src/components/graph/GraphControl.tsx @@ -218,7 +218,7 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean }) // Node reducer for node appearance nodeReducer: (node, data) => { const graph = sigma.getGraph() - + // Add defensive check for node existence during theme switching if (!graph.hasNode(node)) { console.warn(`Node ${node} not found in graph during theme switch, returning default data`) @@ -275,7 +275,7 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean }) // Edge reducer for edge appearance edgeReducer: (edge, data) => { const graph = sigma.getGraph() - + // Add defensive check for edge existence during theme switching if (!graph.hasEdge(edge)) { console.warn(`Edge ${edge} not found in graph during theme switch, returning default data`) diff --git a/lightrag_webui/src/components/graph/GraphSearch.tsx b/lightrag_webui/src/components/graph/GraphSearch.tsx index d181c6b3..0b7c2577 100644 --- a/lightrag_webui/src/components/graph/GraphSearch.tsx +++ b/lightrag_webui/src/components/graph/GraphSearch.tsx @@ -22,21 +22,21 @@ export interface OptionItem { const NodeOption = ({ id }: { id: string }) => { const graph = useGraphStore.use.sigmaGraph() - + // Early return if no graph or node doesn't exist if (!graph?.hasNode(id)) { return null } - + // Safely get node attributes with fallbacks const label = graph.getNodeAttribute(id, 'label') || id const color = graph.getNodeAttribute(id, 'color') || '#666' const size = graph.getNodeAttribute(id, 'size') || 4 - + // Custom node display component that doesn't rely on @react-sigma/graph-search return (
-
0) { newSearchEngine.addAll(documents) } diff --git a/lightrag_webui/src/features/GraphViewer.tsx b/lightrag_webui/src/features/GraphViewer.tsx index bc62bc31..5649f1e7 100644 --- a/lightrag_webui/src/features/GraphViewer.tsx +++ b/lightrag_webui/src/features/GraphViewer.tsx @@ -136,7 +136,7 @@ const GraphViewer = () => { if (isThemeChange) { setIsThemeSwitching(true) console.log('Theme switching detected:', prevTheme.current, '->', theme) - + // Reset theme switching state after a short delay const timer = setTimeout(() => { setIsThemeSwitching(false)