Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 28 additions & 177 deletions app/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"preview": "vite preview"
},
"dependencies": {
"@falkordb/canvas": "^0.0.44",
"@falkordb/canvas": "file:../../falkordb-canvas",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the local `@falkordb/canvas` package exists and has required files

# Check if the directory exists
if [ -d "../../falkordb-canvas" ]; then
  echo "✓ Directory exists at ../../falkordb-canvas"
  
  # Check for package.json
  if [ -f "../../falkordb-canvas/package.json" ]; then
    echo "✓ package.json found"
    cat ../../falkordb-canvas/package.json | jq '{name, version, main, types, exports}'
  else
    echo "✗ package.json NOT found"
  fi
  
  # Check for TypeScript definitions
  fd -e d.ts . ../../falkordb-canvas -x echo "Found: {}"
  
  # List directory structure
  tree -L 2 ../../falkordb-canvas || ls -la ../../falkordb-canvas
else
  echo "✗ Directory does NOT exist at ../../falkordb-canvas"
  echo "Current directory structure:"
  pwd
  ls -la ../..
fi

Repository: FalkorDB/code-graph

Length of output: 329


Critical: @falkordb/canvas local file:../../falkordb-canvas path is missing in this checkout (causes TS2307).

File: app/package.json (line 14)

The file:../../falkordb-canvas directory isn’t present in the repo checkout, so @falkordb/canvas can’t be resolved and TypeScript fails with TS2307. Fix the file: path to the actual location (or wire it via the workspace setup) and ensure the package exports/provides TypeScript type declarations.

🧰 Tools
🪛 GitHub Actions: Playwright Tests / test (2)

[error] Build step failed: 'npm run build' (runs 'tsc -b && vite build'). Command exited with a non-zero status due to the TypeScript error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/package.json` at line 14, The package dependency "`@falkordb/canvas`" in
app/package.json currently points to a missing local path
"file:../../falkordb-canvas" causing TS2307; fix it by updating the dependency
to a valid reference (either correct the relative file: path to the actual local
package location, replace it with the workspace / monorepo package name if using
workspaces, or point to a published version on the registry), then ensure the
target package exports TypeScript declarations (include "types" or .d.ts files
or set "declaration": true in its tsconfig) so imports resolve correctly; look
for the dependency entry in app/package.json and adjust it and the referenced
package's package.json/tsconfig accordingly.

"@radix-ui/react-checkbox": "^1.1.4",
"@radix-ui/react-dialog": "^1.1.6",
"@radix-ui/react-dropdown-menu": "^2.1.6",
Expand Down
25 changes: 12 additions & 13 deletions app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Labels } from './components/labels';
import { Toolbar } from './components/toolbar';
import { cn, GraphRef, Message, Path, PathData, PathNode } from '@/lib/utils';
import type { GraphNode } from '@falkordb/canvas';
import { graphDataToData } from '@falkordb/canvas';
import { Toaster } from '@/components/ui/toaster';
import GTM from './GTM';
import { Button } from '@/components/ui/button';
Expand Down Expand Up @@ -79,7 +80,8 @@ export default function App() {
const [menuOpen, setMenuOpen] = useState(false)
const [chatOpen, setChatOpen] = useState(false)
const [searchNode, setSearchNode] = useState<PathNode>({});
const [cooldownTicks, setCooldownTicks] = useState<number | undefined>(0)
const [cooldownTicks, setCooldownTicks] = useState<number | undefined>(undefined)
const [animation, setAnimation] = useState(false)
const [optionsOpen, setOptionsOpen] = useState(false)
const [messages, setMessages] = useState<Message[]>([]);
const [query, setQuery] = useState('');
Expand Down Expand Up @@ -174,8 +176,6 @@ export default function App() {
const g = Graph.create(json.entities, graphName)
setGraph(g)

if (cooldownTicks === 0) setCooldownTicks(-1)

setIsPathResponse(false)
chatPanel.current?.expand()
// @ts-ignore
Expand Down Expand Up @@ -225,8 +225,6 @@ export default function App() {
if (!chartNode) {
chartNode = graph.extend({ nodes: [node], edges: [] }).nodes[0]

if (cooldownTicks === 0) setCooldownTicks(-1)

setZoomedNodes([chartNode])
graph.visibleLinks(true, [chartNode!.id])

Expand All @@ -251,7 +249,7 @@ export default function App() {
currentData.nodes.push(graphNode)
}

canvas.setGraphData(currentData)
canvas.setGraphData(graphDataToData(currentData))


setTimeout(() => {
Expand Down Expand Up @@ -280,7 +278,7 @@ export default function App() {
}
})

canvas.setGraphData(currentData)
canvas.setGraphData(graphDataToData(currentData))
}

setTimeout(() => {
Expand Down Expand Up @@ -324,9 +322,8 @@ export default function App() {
}
});

canvas.setGraphData(currentData);
canvas.setGraphData(graphDataToData(currentData));

setCooldownTicks(cooldownTicks === undefined ? undefined : -1);
setHasHiddenElements(graph.getElements().some(element => !element.visible));
}

Expand Down Expand Up @@ -540,6 +537,8 @@ export default function App() {
setSearchNode={setSearchNode}
cooldownTicks={cooldownTicks}
setCooldownTicks={setCooldownTicks}
animation={animation}
setAnimation={setAnimation}
onCategoryClick={(name, show) => onCategoryClick(name, show, desktopChartRef)}
handleDownloadImage={handleDownloadImage}
zoomedNodes={zoomedNodes}
Expand Down Expand Up @@ -574,7 +573,6 @@ export default function App() {
setIsPathResponse={setIsPathResponse}
paths={paths}
setPaths={setPaths}
setCooldownTicks={setCooldownTicks}
/>
</Panel>
</PanelGroup>
Expand Down Expand Up @@ -667,6 +665,8 @@ export default function App() {
searchNode={searchNode}
cooldownTicks={cooldownTicks}
setCooldownTicks={setCooldownTicks}
animation={animation}
setAnimation={setAnimation}
onCategoryClick={(name, show) => onCategoryClick(name, show, mobileChartRef)}
handleDownloadImage={handleDownloadImage}
zoomedNodes={zoomedNodes}
Expand Down Expand Up @@ -705,7 +705,6 @@ export default function App() {
setChatOpen={setChatOpen}
paths={paths}
setPaths={setPaths}
setCooldownTicks={setCooldownTicks}
/>
</DrawerContent>
</Drawer>
Expand All @@ -723,8 +722,8 @@ export default function App() {
<Toolbar
className='bg-transparent absolute -top-14 left-0 w-full justify-between px-6'
canvasRef={mobileChartRef}
setCooldownTicks={setCooldownTicks}
cooldownTicks={cooldownTicks}
animation={animation}
setAnimation={setAnimation}
/>
<Input
className='border-2 border-border'
Expand Down
34 changes: 18 additions & 16 deletions app/src/components/ForceGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ interface Props {
linkLineDash: (link: any) => number[]
onZoom: () => void
onEngineStop: () => void
cooldownTicks: number | undefined
animation: boolean
backgroundColor?: string
foregroundColor?: string
}


const convertToCanvasData = (graphData: GraphData): Data => ({
nodes: graphData.nodes.filter(n => n.visible).map(({ id, category, color, visible, isPath, isPathSelected, data }) => ({
id,
Expand Down Expand Up @@ -66,7 +67,7 @@ export default function ForceGraph({
nodeCanvasObject,
nodePointerAreaPaint,
linkLineDash,
cooldownTicks,
animation,
backgroundColor = "#FFFFFF",
foregroundColor = "#000000"
}: Props) {
Expand Down Expand Up @@ -94,12 +95,12 @@ export default function ForceGraph({
canvasRef.current.setForegroundColor(foregroundColor)
}, [canvasRef, backgroundColor, foregroundColor, canvasLoaded])

// Update cooldown ticks
// Update animation state on canvas
useEffect(() => {
if (!canvasRef.current || !canvasLoaded) return

canvasRef.current.setCooldownTicks(cooldownTicks === -1 ? undefined : cooldownTicks)
}, [canvasRef, cooldownTicks, canvasLoaded])
canvasRef.current.setAnimation(animation)
}, [canvasRef, animation, canvasLoaded])

// Map node click handler
const handleNodeClick = useCallback((node: GraphNode, event: MouseEvent) => {
Expand Down Expand Up @@ -158,23 +159,24 @@ export default function ForceGraph({
useEffect(() => {
if (!canvasRef.current || !canvasLoaded) return
canvasRef.current.setConfig({
autoStopOnSettle: false,
// nodes will display node.data.captionsKeys in the canvas
captionsKeys: ["name", "title"],
onNodeClick: handleNodeClick,
onNodeRightClick: handleNodeRightClick,
onNodeHover: handleNodeHover,
isNodeSelected: isNodeSelected,
onLinkClick: handleLinkClick,
onLinkRightClick: handleLinkRightClick,
onLinkHover: handleLinkHover,
isLinkSelected: isLinkSelected,
onBackgroundClick,
onBackgroundRightClick,
onEngineStop: handleEngineStop,
node: { nodeCanvasObject, nodePointerAreaPaint },
linkLineDash,
onZoom
eventHandlers: {
onNodeClick: handleNodeClick,
onNodeRightClick: handleNodeRightClick,
onNodeHover: handleNodeHover,
onLinkClick: handleLinkClick,
onLinkRightClick: handleLinkRightClick,
onLinkHover: handleLinkHover,
onBackgroundClick,
onBackgroundRightClick,
onEngineStop: handleEngineStop,
onZoom
}
})
}, [
handleNodeClick,
Expand Down
Loading
Loading