Fix linting

This commit is contained in:
yangdx 2025-09-22 03:29:17 +08:00
parent b13209e241
commit fca3ea5d20
3 changed files with 8 additions and 8 deletions

View file

@ -218,7 +218,7 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
// Node reducer for node appearance // Node reducer for node appearance
nodeReducer: (node, data) => { nodeReducer: (node, data) => {
const graph = sigma.getGraph() const graph = sigma.getGraph()
// Add defensive check for node existence during theme switching // Add defensive check for node existence during theme switching
if (!graph.hasNode(node)) { if (!graph.hasNode(node)) {
console.warn(`Node ${node} not found in graph during theme switch, returning default data`) console.warn(`Node ${node} not found in graph during theme switch, returning default data`)
@ -275,7 +275,7 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
// Edge reducer for edge appearance // Edge reducer for edge appearance
edgeReducer: (edge, data) => { edgeReducer: (edge, data) => {
const graph = sigma.getGraph() const graph = sigma.getGraph()
// Add defensive check for edge existence during theme switching // Add defensive check for edge existence during theme switching
if (!graph.hasEdge(edge)) { if (!graph.hasEdge(edge)) {
console.warn(`Edge ${edge} not found in graph during theme switch, returning default data`) console.warn(`Edge ${edge} not found in graph during theme switch, returning default data`)

View file

@ -22,21 +22,21 @@ export interface OptionItem {
const NodeOption = ({ id }: { id: string }) => { const NodeOption = ({ id }: { id: string }) => {
const graph = useGraphStore.use.sigmaGraph() const graph = useGraphStore.use.sigmaGraph()
// Early return if no graph or node doesn't exist // Early return if no graph or node doesn't exist
if (!graph?.hasNode(id)) { if (!graph?.hasNode(id)) {
return null return null
} }
// Safely get node attributes with fallbacks // Safely get node attributes with fallbacks
const label = graph.getNodeAttribute(id, 'label') || id const label = graph.getNodeAttribute(id, 'label') || id
const color = graph.getNodeAttribute(id, 'color') || '#666' const color = graph.getNodeAttribute(id, 'color') || '#666'
const size = graph.getNodeAttribute(id, 'size') || 4 const size = graph.getNodeAttribute(id, 'size') || 4
// Custom node display component that doesn't rely on @react-sigma/graph-search // Custom node display component that doesn't rely on @react-sigma/graph-search
return ( return (
<div className="flex items-center gap-2 p-2 text-sm"> <div className="flex items-center gap-2 p-2 text-sm">
<div <div
className="rounded-full flex-shrink-0" className="rounded-full flex-shrink-0"
style={{ style={{
width: Math.max(8, Math.min(size * 2, 16)), width: Math.max(8, Math.min(size * 2, 16)),
@ -110,7 +110,7 @@ export const GraphSearchInput = ({
id: id, id: id,
label: graph.getNodeAttribute(id, 'label') label: graph.getNodeAttribute(id, 'label')
})) }))
if (documents.length > 0) { if (documents.length > 0) {
newSearchEngine.addAll(documents) newSearchEngine.addAll(documents)
} }

View file

@ -136,7 +136,7 @@ const GraphViewer = () => {
if (isThemeChange) { if (isThemeChange) {
setIsThemeSwitching(true) setIsThemeSwitching(true)
console.log('Theme switching detected:', prevTheme.current, '->', theme) console.log('Theme switching detected:', prevTheme.current, '->', theme)
// Reset theme switching state after a short delay // Reset theme switching state after a short delay
const timer = setTimeout(() => { const timer = setTimeout(() => {
setIsThemeSwitching(false) setIsThemeSwitching(false)