Fix show node label settings error

This commit is contained in:
yangdx
2025-03-14 03:42:46 +08:00
parent 9b01d50823
commit 87366c63da
4 changed files with 49 additions and 51 deletions

View File

@@ -8,7 +8,7 @@
<link rel="icon" type="image/svg+xml" href="./logo.png" /> <link rel="icon" type="image/svg+xml" href="./logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lightrag</title> <title>Lightrag</title>
<script type="module" crossorigin src="./assets/index-HWWfOWMh.js"></script> <script type="module" crossorigin src="./assets/index-DwcJE583.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BV5s8k-a.css"> <link rel="stylesheet" crossorigin href="./assets/index-BV5s8k-a.css">
</head> </head>
<body> <body>

View File

@@ -36,6 +36,7 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
const hideUnselectedEdges = useSettingsStore.use.enableHideUnselectedEdges() const hideUnselectedEdges = useSettingsStore.use.enableHideUnselectedEdges()
const enableEdgeEvents = useSettingsStore.use.enableEdgeEvents() const enableEdgeEvents = useSettingsStore.use.enableEdgeEvents()
const renderEdgeLabels = useSettingsStore.use.showEdgeLabel() const renderEdgeLabels = useSettingsStore.use.showEdgeLabel()
const renderLabels = useSettingsStore.use.showNodeLabel()
const selectedNode = useGraphStore.use.selectedNode() const selectedNode = useGraphStore.use.selectedNode()
const focusedNode = useGraphStore.use.focusedNode() const focusedNode = useGraphStore.use.focusedNode()
const selectedEdge = useGraphStore.use.selectedEdge() const selectedEdge = useGraphStore.use.selectedEdge()
@@ -117,11 +118,12 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
const labelColor = isDarkTheme ? Constants.labelColorDarkTheme : undefined const labelColor = isDarkTheme ? Constants.labelColorDarkTheme : undefined
const edgeColor = isDarkTheme ? Constants.edgeColorDarkTheme : undefined const edgeColor = isDarkTheme ? Constants.edgeColorDarkTheme : undefined
// Update edge-related settings directly without recreating the sigma container // Update all dynamic settings directly without recreating the sigma container
setSettings({ setSettings({
// Update edge-specific settings // Update display settings
enableEdgeEvents, enableEdgeEvents,
renderEdgeLabels, renderEdgeLabels,
renderLabels,
// Node reducer for node appearance // Node reducer for node appearance
nodeReducer: (node, data) => { nodeReducer: (node, data) => {
@@ -207,7 +209,8 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
theme, theme,
hideUnselectedEdges, hideUnselectedEdges,
enableEdgeEvents, enableEdgeEvents,
renderEdgeLabels renderEdgeLabels,
renderLabels
]) ])
return null return null

View File

@@ -122,8 +122,6 @@ const GraphViewer = () => {
const showPropertyPanel = useSettingsStore.use.showPropertyPanel() const showPropertyPanel = useSettingsStore.use.showPropertyPanel()
const showNodeSearchBar = useSettingsStore.use.showNodeSearchBar() const showNodeSearchBar = useSettingsStore.use.showNodeSearchBar()
const renderLabels = useSettingsStore.use.showNodeLabel()
const enableNodeDrag = useSettingsStore.use.enableNodeDrag() const enableNodeDrag = useSettingsStore.use.enableNodeDrag()
// Handle component mount/unmount and tab visibility // Handle component mount/unmount and tab visibility
@@ -145,13 +143,10 @@ const GraphViewer = () => {
}, [isGraphTabVisible, shouldRender, isFetching]) }, [isGraphTabVisible, shouldRender, isFetching])
// Initialize sigma settings once on component mount // Initialize sigma settings once on component mount
// Edge-related settings will be updated in GraphControl using useSetSettings // All dynamic settings will be updated in GraphControl using useSetSettings
useEffect(() => { useEffect(() => {
setSigmaSettings({ setSigmaSettings(defaultSigmaSettings)
...defaultSigmaSettings, }, [])
renderLabels
})
}, [renderLabels])
const onSearchFocus = useCallback((value: GraphSearchOption | null) => { const onSearchFocus = useCallback((value: GraphSearchOption | null) => {
if (value === null) useGraphStore.getState().setFocusedNode(null) if (value === null) useGraphStore.getState().setFocusedNode(null)