Remove graphSearchTypes.ts, move OptionItem type to GraphSearch.tsx

This commit is contained in:
yangdx
2025-03-16 03:01:36 +08:00
parent 29c32955c4
commit 7d4390af96
4 changed files with 9 additions and 9 deletions

View File

@@ -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();
}

View File

@@ -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)) {

View File

@@ -1,5 +0,0 @@
export interface OptionItem {
id: string
type: 'nodes' | 'edges' | 'message'
message?: string
}

View File

@@ -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
});