mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 20:23:36 +00:00
small log fix
This commit is contained in:
@@ -142,9 +142,6 @@ function GraphCanvasInner({
|
||||
// No new nodes - just update data without changing positions
|
||||
setNodes((currentNodes) => {
|
||||
const positionMap = new Map(currentNodes.map((n) => [n.id, n.position]));
|
||||
// Filter to only include nodes that still exist
|
||||
const existingNodeIds = new Set(layoutedNodes.map((n) => n.id));
|
||||
|
||||
return layoutedNodes.map((node) => ({
|
||||
...node,
|
||||
position: positionMap.get(node.id) || node.position,
|
||||
|
||||
@@ -85,34 +85,8 @@ export function GraphView({
|
||||
// Handle creating a dependency via edge connection
|
||||
const handleCreateDependency = useCallback(
|
||||
async (sourceId: string, targetId: string): Promise<boolean> => {
|
||||
const sourceFeature = features.find((f) => f.id === sourceId);
|
||||
const targetFeature = features.find((f) => f.id === targetId);
|
||||
|
||||
// Debug logging
|
||||
console.log('[Dependency Check] ===========================');
|
||||
console.log('[Dependency Check] Source (prerequisite):', {
|
||||
id: sourceId,
|
||||
title: sourceFeature?.title || sourceFeature?.description?.slice(0, 50),
|
||||
dependencies: sourceFeature?.dependencies,
|
||||
});
|
||||
console.log('[Dependency Check] Target (will depend on source):', {
|
||||
id: targetId,
|
||||
title: targetFeature?.title || targetFeature?.description?.slice(0, 50),
|
||||
dependencies: targetFeature?.dependencies,
|
||||
});
|
||||
console.log(
|
||||
'[Dependency Check] Action:',
|
||||
`${targetFeature?.title || targetId} will depend on ${sourceFeature?.title || sourceId}`
|
||||
);
|
||||
console.log(
|
||||
'[Dependency Check] All features:',
|
||||
features.map((f) => ({
|
||||
id: f.id,
|
||||
title: f.title || f.description?.slice(0, 30),
|
||||
deps: f.dependencies,
|
||||
}))
|
||||
);
|
||||
|
||||
// Prevent self-dependency
|
||||
if (sourceId === targetId) {
|
||||
toast.error('A task cannot depend on itself');
|
||||
@@ -128,15 +102,7 @@ export function GraphView({
|
||||
// Check for circular dependency
|
||||
// This checks: if we make targetId depend on sourceId, would it create a cycle?
|
||||
// A cycle would occur if sourceId already depends on targetId (transitively)
|
||||
console.log('[Cycle Check] Checking if adding dependency would create cycle...');
|
||||
console.log(
|
||||
'[Cycle Check] Would create cycle if:',
|
||||
sourceFeature?.title || sourceId,
|
||||
'already depends on',
|
||||
targetFeature?.title || targetId
|
||||
);
|
||||
const wouldCycle = wouldCreateCircularDependency(features, sourceId, targetId);
|
||||
console.log('[Cycle Check] Result:', wouldCycle ? 'WOULD CREATE CYCLE' : 'Safe to add');
|
||||
if (wouldCycle) {
|
||||
toast.error('Cannot create circular dependency', {
|
||||
description: 'This would create a dependency cycle',
|
||||
|
||||
Reference in New Issue
Block a user