Remove unused codes
This commit is contained in:
@@ -225,7 +225,6 @@ const useLightrangeGraph = () => {
|
|||||||
if (rawGraph !== null || sigmaGraph !== null) {
|
if (rawGraph !== null || sigmaGraph !== null) {
|
||||||
const state = useGraphStore.getState()
|
const state = useGraphStore.getState()
|
||||||
state.reset()
|
state.reset()
|
||||||
state.setGraphLabels(['*'])
|
|
||||||
state.setGraphDataFetchAttempted(false)
|
state.setGraphDataFetchAttempted(false)
|
||||||
state.setLabelsFetchAttempted(false)
|
state.setLabelsFetchAttempted(false)
|
||||||
}
|
}
|
||||||
@@ -285,24 +284,7 @@ const useLightrangeGraph = () => {
|
|||||||
state.setSigmaGraph(newSigmaGraph)
|
state.setSigmaGraph(newSigmaGraph)
|
||||||
state.setRawGraph(data)
|
state.setRawGraph(data)
|
||||||
|
|
||||||
// Extract labels from current graph data
|
// No longer need to extract labels from graph data
|
||||||
if (data) {
|
|
||||||
const labelSet = new Set<string>()
|
|
||||||
for (const node of data.nodes) {
|
|
||||||
if (node.labels && Array.isArray(node.labels)) {
|
|
||||||
for (const label of node.labels) {
|
|
||||||
if (label !== '*') { // filter out label "*"
|
|
||||||
labelSet.add(label)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Put * on top of other labels
|
|
||||||
const sortedLabels = Array.from(labelSet).sort()
|
|
||||||
state.setGraphLabels(['*', ...sortedLabels])
|
|
||||||
} else {
|
|
||||||
state.setGraphLabels(['*'])
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update flags
|
// Update flags
|
||||||
dataLoadedRef.current = true
|
dataLoadedRef.current = true
|
||||||
|
@@ -66,7 +66,6 @@ interface GraphState {
|
|||||||
|
|
||||||
rawGraph: RawGraph | null
|
rawGraph: RawGraph | null
|
||||||
sigmaGraph: DirectedGraph | null
|
sigmaGraph: DirectedGraph | null
|
||||||
graphLabels: string[]
|
|
||||||
allDatabaseLabels: string[]
|
allDatabaseLabels: string[]
|
||||||
|
|
||||||
moveToSelectedNode: boolean
|
moveToSelectedNode: boolean
|
||||||
@@ -89,7 +88,6 @@ interface GraphState {
|
|||||||
|
|
||||||
setRawGraph: (rawGraph: RawGraph | null) => void
|
setRawGraph: (rawGraph: RawGraph | null) => void
|
||||||
setSigmaGraph: (sigmaGraph: DirectedGraph | null) => void
|
setSigmaGraph: (sigmaGraph: DirectedGraph | null) => void
|
||||||
setGraphLabels: (labels: string[]) => void
|
|
||||||
setAllDatabaseLabels: (labels: string[]) => void
|
setAllDatabaseLabels: (labels: string[]) => void
|
||||||
fetchAllDatabaseLabels: () => Promise<void>
|
fetchAllDatabaseLabels: () => Promise<void>
|
||||||
setIsFetching: (isFetching: boolean) => void
|
setIsFetching: (isFetching: boolean) => void
|
||||||
@@ -116,7 +114,6 @@ const useGraphStoreBase = create<GraphState>()((set, get) => ({
|
|||||||
|
|
||||||
rawGraph: null,
|
rawGraph: null,
|
||||||
sigmaGraph: null,
|
sigmaGraph: null,
|
||||||
graphLabels: ['*'],
|
|
||||||
allDatabaseLabels: ['*'],
|
allDatabaseLabels: ['*'],
|
||||||
|
|
||||||
refreshLayout: () => {
|
refreshLayout: () => {
|
||||||
@@ -161,7 +158,6 @@ const useGraphStoreBase = create<GraphState>()((set, get) => ({
|
|||||||
focusedEdge: null,
|
focusedEdge: null,
|
||||||
rawGraph: null,
|
rawGraph: null,
|
||||||
// Keep the existing graph instance but with cleared data
|
// Keep the existing graph instance but with cleared data
|
||||||
graphLabels: ['*'],
|
|
||||||
moveToSelectedNode: false,
|
moveToSelectedNode: false,
|
||||||
shouldRender: false
|
shouldRender: false
|
||||||
});
|
});
|
||||||
@@ -177,8 +173,6 @@ const useGraphStoreBase = create<GraphState>()((set, get) => ({
|
|||||||
set({ sigmaGraph });
|
set({ sigmaGraph });
|
||||||
},
|
},
|
||||||
|
|
||||||
setGraphLabels: (labels: string[]) => set({ graphLabels: labels }),
|
|
||||||
|
|
||||||
setAllDatabaseLabels: (labels: string[]) => set({ allDatabaseLabels: labels }),
|
setAllDatabaseLabels: (labels: string[]) => set({ allDatabaseLabels: labels }),
|
||||||
|
|
||||||
fetchAllDatabaseLabels: async () => {
|
fetchAllDatabaseLabels: async () => {
|
||||||
|
Reference in New Issue
Block a user