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