Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

fix(frontend): resolve no-unused-vars, fix two real bugs found along the way

dextmorgn2b988f034f41
diff --git a/flowsint-app/.eslintrc.cjs b/flowsint-app/.eslintrc.cjs
index 2b3f6b73..8150c48c 100644
--- a/flowsint-app/.eslintrc.cjs
+++ b/flowsint-app/.eslintrc.cjs
@@ -18,7 +18,14 @@ module.exports = {
rules: {
// TS already checks unused vars/undefined names better than eslint's base rules.
'no-unused-vars': 'off',
- '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
+ '@typescript-eslint/no-unused-vars': [
+ 'warn',
+ {
+ argsIgnorePattern: '^_',
+ varsIgnorePattern: '^_',
+ destructuredArrayIgnorePattern: '^_'
+ }
+ ],
// ~290 pre-existing `any` uses. Real debt, but not a hazard on the level of
// an unchecked hook — downgrade to visible-not-blocking rather than pretend
// it's fixed. Tighten to 'error' once the backlog is paid down.
diff --git a/flowsint-app/src/components/analyses/editor/extensions/image/components/image-view-block.tsx b/flowsint-app/src/components/analyses/editor/extensions/image/components/image-view-block.tsx
index de0dd5f8..cad68066 100644
--- a/flowsint-app/src/components/analyses/editor/extensions/image/components/image-view-block.tsx
+++ b/flowsint-app/src/components/analyses/editor/extensions/image/components/image-view-block.tsx
@@ -179,7 +179,7 @@ export const ImageViewBlock: React.FC<NodeViewProps> = ({
}))
updateAttributes(normalizedData)
- } catch (error) {
+ } catch {
setImageState((prev) => ({
...prev,
error: true,
diff --git a/flowsint-app/src/components/analyses/editor/extensions/mention/mention.tsx b/flowsint-app/src/components/analyses/editor/extensions/mention/mention.tsx
index fba161f4..f82de0e2 100644
--- a/flowsint-app/src/components/analyses/editor/extensions/mention/mention.tsx
+++ b/flowsint-app/src/components/analyses/editor/extensions/mention/mention.tsx
@@ -11,11 +11,9 @@ import type { MentionListRef, MentionItem } from './mention-list'
import { memo, useCallback } from 'react'
import { useIcon } from '@/hooks/use-icon'
import { useNodesDisplaySettings } from '@/stores/node-display-settings'
-import { Button } from '@/components/ui/button'
import { GRAPH_COLORS } from '@/components/sketches/graph'
import { useGraphStore } from '@/stores/graph-store'
import { useGraphControls } from '@/stores/graph-controls-store'
-import { GraphNode } from '@/types'
function hexWithOpacity(hex: string, opacity: number) {
hex = hex.replace('#', '')
diff --git a/flowsint-app/src/components/chat/memoized-markdown.tsx b/flowsint-app/src/components/chat/memoized-markdown.tsx
index 28982a3b..1f39bd26 100644
--- a/flowsint-app/src/components/chat/memoized-markdown.tsx
+++ b/flowsint-app/src/components/chat/memoized-markdown.tsx
@@ -17,7 +17,7 @@ const MemoizedMarkdownBlock = memo(
return (
<ReactMarkdown
components={{
- code({ node, className, children, ...props }) {
+ code({ node: _node, className, children, ...props }) {
const match = /language-(\w+)/.exec(className || '')
return match ? (
<div className="relative">
diff --git a/flowsint-app/src/components/custom-types/type-preview.tsx b/flowsint-app/src/components/custom-types/type-preview.tsx
index 96cd2ebf..e916f85b 100644
--- a/flowsint-app/src/components/custom-types/type-preview.tsx
+++ b/flowsint-app/src/components/custom-types/type-preview.tsx
@@ -1,5 +1,4 @@
import * as LucideIcons from 'lucide-react'
-import { Badge } from '@/components/ui/badge'
import type { SchemaField } from './field-row'
interface TypePreviewProps {
@@ -40,7 +39,15 @@ export function TypePreview({
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
<h4 className="font-semibold text-sm truncate">{name || 'Untitled type'}</h4>
+ {status === 'draft' && (
+ <span className="shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground border border-border/60 rounded px-1.5 py-0.5">
+ Draft
+ </span>
+ )}
</div>
+ {category && (
+ <p className="text-xs text-muted-foreground/70 mt-0.5 truncate">{category}</p>
+ )}
<p className="text-xs text-muted-foreground mt-0.5 line-clamp-2">
{description || 'No description'}
</p>
diff --git a/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx b/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx
index 1061214a..d2657dd2 100644
--- a/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx
+++ b/flowsint-app/src/components/dashboard/investigation/investigations-list.tsx
@@ -1,4 +1,4 @@
-import { FolderOpen, MoreHorizontal, FileText, Network } from 'lucide-react'
+import { FolderOpen, FileText, Network } from 'lucide-react'
import { cn } from '@/lib/utils'
import { Link } from '@tanstack/react-router'
import { Investigation } from '@/types'
diff --git a/flowsint-app/src/components/flows/flow-name-panel.tsx b/flowsint-app/src/components/flows/flow-name-panel.tsx
index e633692a..0b0af28d 100644
--- a/flowsint-app/src/components/flows/flow-name-panel.tsx
+++ b/flowsint-app/src/components/flows/flow-name-panel.tsx
@@ -85,7 +85,7 @@ export const FlowNamePanel = ({ flow, onUpdate, disabled = false }: FlowNamePane
flowId: flow.id,
body: JSON.stringify(updates)
})
- } catch (error) {
+ } catch {
// Revert local state on error
if (field === 'name') {
setName(flow.name)
diff --git a/flowsint-app/src/components/map/map.tsx b/flowsint-app/src/components/map/map.tsx
index 36e95111..d22c0bac 100644
--- a/flowsint-app/src/components/map/map.tsx
+++ b/flowsint-app/src/components/map/map.tsx
@@ -119,7 +119,7 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({
} | null>(null)
const [isGlobe, setIsGlobe] = useState(true)
const isGlobeRef = useRef(true)
- const [styleVariant, setStyleVariant] = useState<MapStyleVariant>('standard')
+ const [styleVariant, _setStyleVariant] = useState<MapStyleVariant>('standard')
const [zoomLevel, setZoomLevel] = useState(2)
const isDarkStyle = resolvedTheme === 'dark' || styleVariant === 'satellite'
const showDetails = zoomLevel >= 6
@@ -195,7 +195,7 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({
const DEFAULT_MARKER_COLOR = '#6366f1'
// Preload icons for all unique node types
- const [iconsReady, setIconsReady] = useState(false)
+ const [_iconsReady, setIconsReady] = useState(false)
useEffect(() => {
const uniqueTypes = new Set<string>()
validLocations.forEach((loc) => {
@@ -437,7 +437,6 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({
const cachedImg =
showDetails && loc.nodeType ? getCachedImage(loc.nodeType, '#ffffff') : undefined
const dotSize = showDetails ? 24 : 10
- const glowSize = showDetails ? 36 : 16
return (
<Marker
key={loc.nodeId || `${lat}-${lon}-${i}`}
diff --git a/flowsint-app/src/components/sketches/add-item-dialog.tsx b/flowsint-app/src/components/sketches/add-item-dialog.tsx
index a157ad22..07b433e8 100644
--- a/flowsint-app/src/components/sketches/add-item-dialog.tsx
+++ b/flowsint-app/src/components/sketches/add-item-dialog.tsx
@@ -1,7 +1,7 @@
import { useState, useCallback } from 'react'
import { v4 as uuidv4 } from 'uuid'
import { Button } from '@/components/ui/button'
-import { ArrowLeft, ArrowRight, Download, Upload } from 'lucide-react'
+import { ArrowLeft, ArrowRight, Download } from 'lucide-react'
import { toast } from 'sonner'
import { cn, flattenObj } from '@/lib/utils'
import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/components/ui/dialog'
diff --git a/flowsint-app/src/components/sketches/details-panel/edge-details-panel.tsx b/flowsint-app/src/components/sketches/details-panel/edge-details-panel.tsx
index 9f401678..1544053b 100644
--- a/flowsint-app/src/components/sketches/details-panel/edge-details-panel.tsx
+++ b/flowsint-app/src/components/sketches/details-panel/edge-details-panel.tsx
@@ -64,7 +64,7 @@ const EdgeDetailsPanel = memo(() => {
})
)
toast.success('Relationship updated successfully.')
- } catch (error) {
+ } catch {
// Rollback on error
updateEdge(edge.id, { label: previousLabel })
toast.error('Failed to update relationship.')
diff --git a/flowsint-app/src/components/sketches/dynamic-form.tsx b/flowsint-app/src/components/sketches/dynamic-form.tsx
index bbfdd3c8..00a1ad4c 100644
--- a/flowsint-app/src/components/sketches/dynamic-form.tsx
+++ b/flowsint-app/src/components/sketches/dynamic-form.tsx
@@ -268,7 +268,7 @@ export function DynamicForm({
defaultValue={
Array.isArray(initialData?.[field.name]) ? initialData?.[field.name] : []
}
- render={({ field: { onChange, value, ref } }) => (
+ render={({ field: { onChange, value } }) => (
<TagsInput
value={Array.isArray(value) ? value : []}
onChange={(tags) => onChange(tags)}
@@ -319,7 +319,7 @@ export function DynamicForm({
<Controller
control={control}
name={field.name}
- render={({ field: { onChange, value, ref } }) => (
+ render={({ field: { onChange, value } }) => (
<Select onValueChange={onChange} value={value || ''} defaultValue={value || ''}>
<SelectTrigger
ref={ref}
diff --git a/flowsint-app/src/components/sketches/filters/filters.tsx b/flowsint-app/src/components/sketches/filters/filters.tsx
index d01764e3..b0629ec6 100644
--- a/flowsint-app/src/components/sketches/filters/filters.tsx
+++ b/flowsint-app/src/components/sketches/filters/filters.tsx
@@ -2,12 +2,10 @@ import { useGraphStore } from '@/stores/graph-store'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { Separator } from '@/components//ui/separator'
import TypeFilters from './type-filters'
-import RuleFilters from './rule-filters'
const Filters = ({ children }: { children: React.ReactNode }) => {
const filters = useGraphStore((s) => s.filters)
const toggleTypeFilter = useGraphStore((s) => s.toggleTypeFilter)
- const setFilters = useGraphStore((s) => s.setFilters)
return (
<Popover>
diff --git a/flowsint-app/src/components/sketches/graph/actions/path-finder.tsx b/flowsint-app/src/components/sketches/graph/actions/path-finder.tsx
index 65385ce1..f1ebb23b 100644
--- a/flowsint-app/src/components/sketches/graph/actions/path-finder.tsx
+++ b/flowsint-app/src/components/sketches/graph/actions/path-finder.tsx
@@ -39,7 +39,7 @@ export function PathFinder() {
} else {
toast.info('No path found between these nodes')
}
- } catch (error) {
+ } catch {
toast.error('Failed to find path')
} finally {
setIsLoading(false)
diff --git a/flowsint-app/src/components/sketches/graph/components/minimap.tsx b/flowsint-app/src/components/sketches/graph/components/minimap.tsx
index e450f7be..2b0f31fe 100644
--- a/flowsint-app/src/components/sketches/graph/components/minimap.tsx
+++ b/flowsint-app/src/components/sketches/graph/components/minimap.tsx
@@ -142,7 +142,7 @@ const MinimapCanvas = ({
ctx.roundRect(rectX, rectY, rectWidth, rectHeight, 2)
ctx.fill()
ctx.stroke()
- } catch (error) {
+ } catch {
// Silent fail if graph not ready
return
}
diff --git a/flowsint-app/src/components/sketches/graph/context-menu/background-context-menu.tsx b/flowsint-app/src/components/sketches/graph/context-menu/background-context-menu.tsx
index db9f1454..208f4486 100644
--- a/flowsint-app/src/components/sketches/graph/context-menu/background-context-menu.tsx
+++ b/flowsint-app/src/components/sketches/graph/context-menu/background-context-menu.tsx
@@ -50,15 +50,18 @@ interface GraphContextMenuProps {
}
export default function BackgroundContextMenu({
- nodes,
+ // nodes/onEdit/onDelete: accepted for interface compatibility with
+ // callers, but this menu reads selection from the store directly and
+ // implements its own delete flow — not wired up here.
+ nodes: _nodes,
top,
left,
right,
bottom,
wrapperWidth,
wrapperHeight,
- onEdit,
- onDelete,
+ onEdit: _onEdit,
+ onDelete: _onDelete,
setMenu,
...props
}: GraphContextMenuProps) {
diff --git a/flowsint-app/src/components/sketches/graph/context-menu/edge-context-menu.tsx b/flowsint-app/src/components/sketches/graph/context-menu/edge-context-menu.tsx
index f79ca9ed..6b923b7c 100644
--- a/flowsint-app/src/components/sketches/graph/context-menu/edge-context-menu.tsx
+++ b/flowsint-app/src/components/sketches/graph/context-menu/edge-context-menu.tsx
@@ -93,7 +93,7 @@ export default function EdgeContextMenu({
})
)
toast.success('Relationship updated successfully.')
- } catch (error) {
+ } catch {
// Rollback on error
updateEdge(edge.id, { label: previousLabel })
toast.error('Failed to update relationship.')
diff --git a/flowsint-app/src/components/sketches/graph/context-menu/node-context-menu.tsx b/flowsint-app/src/components/sketches/graph/context-menu/node-context-menu.tsx
index d40de920..138f98c1 100644
--- a/flowsint-app/src/components/sketches/graph/context-menu/node-context-menu.tsx
+++ b/flowsint-app/src/components/sketches/graph/context-menu/node-context-menu.tsx
@@ -51,8 +51,10 @@ export default function ContextMenu({
bottom,
wrapperWidth,
wrapperHeight,
- onEdit,
- onDelete,
+ // onEdit/onDelete: accepted for interface compatibility with callers, but
+ // this menu implements its own delete flow internally — not wired up here.
+ onEdit: _onEdit,
+ onDelete: _onDelete,
setMenu,
...props
}: GraphContextMenuProps) {
diff --git a/flowsint-app/src/components/sketches/graph/hooks/use-create-on-paste.ts b/flowsint-app/src/components/sketches/graph/hooks/use-create-on-paste.ts
index 4655f606..09872cd8 100644
--- a/flowsint-app/src/components/sketches/graph/hooks/use-create-on-paste.ts
+++ b/flowsint-app/src/components/sketches/graph/hooks/use-create-on-paste.ts
@@ -32,7 +32,7 @@ export function useCreateOnPaste(sketchId: string) {
}
await createNode(nodeWithTempId, sketchId, addNode, replaceNode)
- } catch (e) {
+ } catch {
toast.error(e.message)
}
},
@@ -62,7 +62,7 @@ export function useCreateOnPaste(sketchId: string) {
nodeMetadata: {}
}
await createNode(nodeWithTempId, sketchId, addNode, replaceNode)
- } catch (e) {
+ } catch {
toast.error(e.message)
}
},
@@ -91,7 +91,7 @@ const createNode = async (
if (newNode) {
replaceNode(node.id, newNode.id, newNode.nodeProperties)
}
- } catch (e) {
+ } catch {
toast.error('Could not create node.')
}
}
diff --git a/flowsint-app/src/components/sketches/graph/hooks/use-keyboard-events.ts b/flowsint-app/src/components/sketches/graph/hooks/use-keyboard-events.ts
index 350c6690..cc258f48 100644
--- a/flowsint-app/src/components/sketches/graph/hooks/use-keyboard-events.ts
+++ b/flowsint-app/src/components/sketches/graph/hooks/use-keyboard-events.ts
@@ -3,7 +3,7 @@ import { useGraphStore } from '@/stores/graph-store'
// import { useCreateOnPaste } from './use-create-on-paste'
import { useKeyboardShortcut } from '@/hooks/use-keyboard-shortcut'
-export const useKeyboardEvents = (sketchId: string) => {
+export const useKeyboardEvents = (_sketchId: string) => {
const setSelectedNodes = useGraphStore((s) => s.setSelectedNodes)
const filteredNodes = useGraphStore((s) => s.filteredNodes)
diff --git a/flowsint-app/src/components/sketches/graph/hooks/use-tooltip.ts b/flowsint-app/src/components/sketches/graph/hooks/use-tooltip.ts
index b580f011..67d1d3cc 100644
--- a/flowsint-app/src/components/sketches/graph/hooks/use-tooltip.ts
+++ b/flowsint-app/src/components/sketches/graph/hooks/use-tooltip.ts
@@ -47,7 +47,7 @@ export const useTooltip = (graphRef: React.RefObject<any>) => {
},
visible: true
})
- } catch (error) {
+ } catch {
setTooltip((prev) => ({ ...prev, visible: false }))
}
},
diff --git a/flowsint-app/src/components/sketches/graph/node/actions/flag.tsx b/flowsint-app/src/components/sketches/graph/node/actions/flag.tsx
index 0b69c082..4e816f96 100644
--- a/flowsint-app/src/components/sketches/graph/node/actions/flag.tsx
+++ b/flowsint-app/src/components/sketches/graph/node/actions/flag.tsx
@@ -1,6 +1,5 @@
import { useCallback, useState, useEffect } from 'react'
import { Button } from '@/components/ui/button'
-import { toast } from 'sonner'
import {
DropdownMenu,
DropdownMenuContent,
diff --git a/flowsint-app/src/components/sketches/graph/utils/image-cache.tsx b/flowsint-app/src/components/sketches/graph/utils/image-cache.tsx
index 62fcbd14..809fdef9 100644
--- a/flowsint-app/src/components/sketches/graph/utils/image-cache.tsx
+++ b/flowsint-app/src/components/sketches/graph/utils/image-cache.tsx
@@ -16,7 +16,7 @@ const createSvgFromIconName = (iconName: string, color: string): string => {
if (IconComponent) {
try {
svgString = renderToStaticMarkup(<IconComponent color={color} />)
- } catch (err) {
+ } catch {
console.warn('[icon] Failed to render icon:', iconName)
svgString = FALLBACK_SVG(color)
}
diff --git a/flowsint-app/src/components/sketches/index.tsx b/flowsint-app/src/components/sketches/index.tsx
index 0b1b701c..0b85f2be 100644
--- a/flowsint-app/src/components/sketches/index.tsx
+++ b/flowsint-app/src/components/sketches/index.tsx
@@ -101,7 +101,7 @@ const GraphPanel = ({ graphData, isLoading }: GraphPanelProps) => {
try {
const parsedData = JSON.parse(data)
handleOpenFormModal(findActionItemByKey(parsedData.itemKey, actionItems))
- } catch (error) {
+ } catch {
return
}
}
diff --git a/flowsint-app/src/components/sketches/toolbar.tsx b/flowsint-app/src/components/sketches/toolbar.tsx
index 54443128..dd7f0abd 100644
--- a/flowsint-app/src/components/sketches/toolbar.tsx
+++ b/flowsint-app/src/components/sketches/toolbar.tsx
@@ -134,7 +134,7 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
const handleRefresh = useCallback(() => {
try {
refetchGraph()
- } catch (error) {
+ } catch {
toast.error('Failed to refresh graph data')
}
}, [refetchGraph])
diff --git a/flowsint-app/src/components/templates/ai-chat-panel.tsx b/flowsint-app/src/components/templates/ai-chat-panel.tsx
index 13462088..23a59abb 100644
--- a/flowsint-app/src/components/templates/ai-chat-panel.tsx
+++ b/flowsint-app/src/components/templates/ai-chat-panel.tsx
@@ -9,7 +9,6 @@ import {
ArrowDownToLine,
Trash2,
Globe,
- Zap,
Wand2
} from 'lucide-react'
import { toast } from 'sonner'
diff --git a/flowsint-app/src/components/terminal/terminal-log-viewer.tsx b/flowsint-app/src/components/terminal/terminal-log-viewer.tsx
index 8ea604da..28c01a4c 100644
--- a/flowsint-app/src/components/terminal/terminal-log-viewer.tsx
+++ b/flowsint-app/src/components/terminal/terminal-log-viewer.tsx
@@ -2,7 +2,7 @@ import { useEffect, useRef, useCallback } from 'react'
import { XTermTerminal, TerminalHandle } from './xterm-terminal'
import { formatLogEntry, formatWelcomeMessage } from './log-formatter'
import { Button } from '../ui/button'
-import { RotateCcw, Trash2, Maximize2 } from 'lucide-react'
+import { RotateCcw, Trash2 } from 'lucide-react'
import { EventLevel } from '@/types'
interface LogEntry {
diff --git a/flowsint-app/src/components/xyflow/button-handle.tsx b/flowsint-app/src/components/xyflow/button-handle.tsx
index ae5b9f15..e1ae8c5a 100644
--- a/flowsint-app/src/components/xyflow/button-handle.tsx
+++ b/flowsint-app/src/components/xyflow/button-handle.tsx
@@ -14,7 +14,8 @@ export const ButtonHandle = ({
label = '',
children,
connectionCount = 5,
- color,
+ // no caller passes this yet; handle color is hardcoded below
+ color: _color,
...props
}: HandleProps & {
showButton?: boolean
diff --git a/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx b/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
index 18d3121b..d07fd1a1 100644
--- a/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
+++ b/flowsint-app/src/routes/_auth.dashboard.investigations.$investigationId.index.tsx
@@ -1,7 +1,4 @@
-import { createFileRoute, useLoaderData, useNavigate } from '@tanstack/react-router'
-import { analysisService } from '@/api/analysis-service'
-import { useMutation, useQueryClient } from '@tanstack/react-query'
-import { toast } from 'sonner'
+import { createFileRoute, useLoaderData } from '@tanstack/react-router'
import { CaseOverviewPage } from '@/components/dashboard/investigation/case-overview-page'
export const Route = createFileRoute('/_auth/dashboard/investigations/$investigationId/')({
@@ -12,36 +9,6 @@ function InvestigationPage() {
const { investigation } = useLoaderData({
from: '/_auth/dashboard/investigations/$investigationId'
})
- const navigate = useNavigate()
- const queryClient = useQueryClient()
-
- const createAnalysisMutation = useMutation({
- mutationFn: async () => {
- const newAnalysis = {
- title: 'Untitled Analysis',
- investigation_id: investigation.id,
- content: {}
- }
- return analysisService.create(JSON.stringify(newAnalysis))
- },
- onSuccess: async (data) => {
- queryClient.invalidateQueries({ queryKey: ['analyses', 'investigation', investigation.id] })
- toast.success('New analysis created')
- navigate({
- to: '/dashboard/investigations/$investigationId/$type/$id',
- params: {
- investigationId: investigation.id,
- type: 'analysis',
- id: data.id
- }
- })
- },
- onError: (error) => {
- toast.error(
- 'Failed to create analysis: ' + (error instanceof Error ? error.message : 'Unknown error')
- )
- }
- })
return <CaseOverviewPage investigation={investigation} />
}
diff --git a/flowsint-app/src/routes/register.tsx b/flowsint-app/src/routes/register.tsx
index ff305c4e..4c8c4301 100644
--- a/flowsint-app/src/routes/register.tsx
+++ b/flowsint-app/src/routes/register.tsx
@@ -43,7 +43,7 @@ function Register() {
const onSubmit = async (data: RegisterFormValues) => {
try {
- const { confirmPassword, ...registerData } = data
+ const { confirmPassword: _confirmPassword, ...registerData } = data
await registerMutation.mutateAsync(registerData)
} catch (error) {
console.error("Erreur d'inscription:", error)
diff --git a/flowsint-app/src/stores/graph-controls-store.ts b/flowsint-app/src/stores/graph-controls-store.ts
index 132a9154..d3ad8154 100644
--- a/flowsint-app/src/stores/graph-controls-store.ts
+++ b/flowsint-app/src/stores/graph-controls-store.ts
@@ -40,7 +40,7 @@ export const useGraphControls = create<GraphControlsStore>()(
centerOnNode: () => {},
onLayout: () => {},
setActions: (actions) => set(actions),
- refetchGraph: (onSuccess) => {},
+ refetchGraph: (_onSuccess) => {},
regenerateLayout: () => {},
getViewportCenter: () => null,
setCurrentLayoutType: (layoutType) => set({ currentLayoutType: layoutType }),
diff --git a/flowsint-app/src/workers/layout.worker.ts b/flowsint-app/src/workers/layout.worker.ts
index ff5da03e..b86bf52b 100644
--- a/flowsint-app/src/workers/layout.worker.ts
+++ b/flowsint-app/src/workers/layout.worker.ts
@@ -1,12 +1,5 @@
import Dagre from '@dagrejs/dagre'
-import {
- forceSimulation,
- forceLink,
- forceManyBody,
- forceCenter,
- forceCollide,
- forceRadial
-} from 'd3-force'
+import { forceSimulation, forceLink, forceManyBody, forceCenter, forceCollide } from 'd3-force'
export interface GraphNode {
id: string
@@ -63,12 +56,15 @@ function computeDagreLayout(
) {
const g = new Dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({}))
- // Configure dagre with proper spacing
+ // Configure dagre with proper spacing. dagLevelDistance mirrors the
+ // main-thread layout in lib/utils.ts's getDagreLayoutedElements — this
+ // worker used to ignore it and hardcode the spacing instead.
+ const levelDistance = options.dagLevelDistance ?? 5
g.setGraph({
rankdir: 'TB',
ranker: 'tight-tree',
- nodesep: 5,
- ranksep: 5
+ nodesep: levelDistance,
+ ranksep: levelDistance
})
const nodeWidth = 15