yangdx
commited on
Commit
·
abf0e97
1
Parent(s):
bd39ed2
Fetch all labels and graph data again on refresh
Browse files
lightrag_webui/src/components/graph/GraphLabels.tsx
CHANGED
@@ -93,9 +93,25 @@ const GraphLabels = () => {
|
|
93 |
)
|
94 |
|
95 |
const handleRefresh = useCallback(() => {
|
96 |
-
//
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}, [])
|
100 |
|
101 |
return (
|
|
|
93 |
)
|
94 |
|
95 |
const handleRefresh = useCallback(() => {
|
96 |
+
// Reset labels fetch status to allow fetching labels again
|
97 |
+
useGraphStore.getState().setLabelsFetchAttempted(false)
|
98 |
+
|
99 |
+
// Reset graph data fetch status directly, not depending on allDatabaseLabels changes
|
100 |
+
useGraphStore.getState().setGraphDataFetchAttempted(false)
|
101 |
+
|
102 |
+
// Fetch all labels again
|
103 |
+
useGraphStore.getState().fetchAllDatabaseLabels()
|
104 |
+
.then(() => {
|
105 |
+
// Trigger a graph data reload by changing the query label back and forth
|
106 |
+
const currentLabel = useSettingsStore.getState().queryLabel
|
107 |
+
useSettingsStore.getState().setQueryLabel('')
|
108 |
+
setTimeout(() => {
|
109 |
+
useSettingsStore.getState().setQueryLabel(currentLabel)
|
110 |
+
}, 0)
|
111 |
+
})
|
112 |
+
.catch((error) => {
|
113 |
+
console.error('Failed to refresh labels:', error)
|
114 |
+
})
|
115 |
}, [])
|
116 |
|
117 |
return (
|
lightrag_webui/src/hooks/useLightragGraph.tsx
CHANGED
@@ -229,7 +229,7 @@ const useLightrangeGraph = () => {
|
|
229 |
return
|
230 |
}
|
231 |
|
232 |
-
// Only fetch data when graphDataFetchAttempted is false
|
233 |
if (!isFetching && !useGraphStore.getState().graphDataFetchAttempted) {
|
234 |
// Set flags
|
235 |
fetchInProgressRef.current = true
|
|
|
229 |
return
|
230 |
}
|
231 |
|
232 |
+
// Only fetch data when graphDataFetchAttempted is false (avoids re-fetching on vite dev mode)
|
233 |
if (!isFetching && !useGraphStore.getState().graphDataFetchAttempted) {
|
234 |
// Set flags
|
235 |
fetchInProgressRef.current = true
|