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