yangdx
commited on
Commit
·
9f2e859
1
Parent(s):
ff37d80
Clear selection and highlights before graph fetch
Browse files- Reset node selection before fetching
- Remove existing node highlights
- Prevent react rendering broken problem
lightrag_webui/src/hooks/useLightragGraph.tsx
CHANGED
|
@@ -214,7 +214,16 @@ const useLightrangeGraph = () => {
|
|
| 214 |
|
| 215 |
// Only fetch if we haven't fetched this combination in the current component lifecycle
|
| 216 |
if (!isFetching && !fetchStatusRef.current[fetchKey]) {
|
| 217 |
-
useGraphStore.getState()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
fetchStatusRef.current[fetchKey] = true;
|
| 219 |
fetchGraph(queryLabel, maxQueryDepth, minDegree).then((data) => {
|
| 220 |
const state = useGraphStore.getState()
|
|
|
|
| 214 |
|
| 215 |
// Only fetch if we haven't fetched this combination in the current component lifecycle
|
| 216 |
if (!isFetching && !fetchStatusRef.current[fetchKey]) {
|
| 217 |
+
const state = useGraphStore.getState();
|
| 218 |
+
// Clear selection and highlighted nodes before fetching new graph
|
| 219 |
+
state.clearSelection();
|
| 220 |
+
if (state.sigmaGraph) {
|
| 221 |
+
state.sigmaGraph.forEachNode((node) => {
|
| 222 |
+
state.sigmaGraph?.setNodeAttribute(node, 'highlighted', false);
|
| 223 |
+
});
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
state.setIsFetching(true);
|
| 227 |
fetchStatusRef.current[fetchKey] = true;
|
| 228 |
fetchGraph(queryLabel, maxQueryDepth, minDegree).then((data) => {
|
| 229 |
const state = useGraphStore.getState()
|