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" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<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">
</head>
<body>

View File

@@ -36,6 +36,7 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
const hideUnselectedEdges = useSettingsStore.use.enableHideUnselectedEdges()
const enableEdgeEvents = useSettingsStore.use.enableEdgeEvents()
const renderEdgeLabels = useSettingsStore.use.showEdgeLabel()
const renderLabels = useSettingsStore.use.showNodeLabel()
const selectedNode = useGraphStore.use.selectedNode()
const focusedNode = useGraphStore.use.focusedNode()
const selectedEdge = useGraphStore.use.selectedEdge()
@@ -117,11 +118,12 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
const labelColor = isDarkTheme ? Constants.labelColorDarkTheme : 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({
// Update edge-specific settings
// Update display settings
enableEdgeEvents,
renderEdgeLabels,
renderLabels,
// Node reducer for node appearance
nodeReducer: (node, data) => {
@@ -207,7 +209,8 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
theme,
hideUnselectedEdges,
enableEdgeEvents,
renderEdgeLabels
renderEdgeLabels,
renderLabels
])
return null

View File

@@ -122,8 +122,6 @@ const GraphViewer = () => {
const showPropertyPanel = useSettingsStore.use.showPropertyPanel()
const showNodeSearchBar = useSettingsStore.use.showNodeSearchBar()
const renderLabels = useSettingsStore.use.showNodeLabel()
const enableNodeDrag = useSettingsStore.use.enableNodeDrag()
// Handle component mount/unmount and tab visibility
@@ -145,13 +143,10 @@ const GraphViewer = () => {
}, [isGraphTabVisible, shouldRender, isFetching])
// 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(() => {
setSigmaSettings({
...defaultSigmaSettings,
renderLabels
})
}, [renderLabels])
setSigmaSettings(defaultSigmaSettings)
}, [])
const onSearchFocus = useCallback((value: GraphSearchOption | null) => {
if (value === null) useGraphStore.getState().setFocusedNode(null)