Remove graphSearchTypes.ts, move OptionItem type to GraphSearch.tsx
This commit is contained in:
@@ -111,7 +111,7 @@ const GraphLabels = () => {
|
||||
// Clear current graph data to ensure complete reload when label changes
|
||||
if (newLabel !== currentLabel) {
|
||||
const graphStore = useGraphStore.getState();
|
||||
// 完全重置图形状态
|
||||
// Reset the all graph objects and status
|
||||
graphStore.reset();
|
||||
}
|
||||
|
||||
|
@@ -10,11 +10,17 @@ import { searchResultLimit } from '@/lib/constants'
|
||||
import { useGraphStore } from '@/stores/graph'
|
||||
import MiniSearch from 'minisearch'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { OptionItem } from './graphSearchTypes'
|
||||
|
||||
// Message item identifier for search results
|
||||
export const messageId = '__message_item'
|
||||
|
||||
// Search result option item interface
|
||||
export interface OptionItem {
|
||||
id: string
|
||||
type: 'nodes' | 'edges' | 'message'
|
||||
message?: string
|
||||
}
|
||||
|
||||
const NodeOption = ({ id }: { id: string }) => {
|
||||
const graph = useGraphStore.use.sigmaGraph()
|
||||
if (!graph?.hasNode(id)) {
|
||||
|
@@ -1,5 +0,0 @@
|
||||
export interface OptionItem {
|
||||
id: string
|
||||
type: 'nodes' | 'edges' | 'message'
|
||||
message?: string
|
||||
}
|
@@ -70,7 +70,6 @@ interface GraphState {
|
||||
sigmaInstance: any | null
|
||||
allDatabaseLabels: string[]
|
||||
|
||||
// 搜索引擎状态
|
||||
searchEngine: MiniSearch | null
|
||||
|
||||
moveToSelectedNode: boolean
|
||||
@@ -159,7 +158,7 @@ const useGraphStoreBase = create<GraphState>()((set) => ({
|
||||
focusedEdge: null,
|
||||
rawGraph: null,
|
||||
sigmaGraph: null, // to avoid other components from acccessing graph objects
|
||||
searchEngine: null, // 重置搜索引擎
|
||||
searchEngine: null,
|
||||
moveToSelectedNode: false,
|
||||
shouldRender: false
|
||||
});
|
||||
|
Reference in New Issue
Block a user