feat: refactor canvas and node components for improved functionality and styling

- Removed unused hooks and optimized edge handling in the canvas component.
- Adjusted positioning of handles in the compare node for better alignment.
- Enhanced prompt node to utilize incoming edges for dynamic prompt generation and improved user feedback.
- Updated text node to synchronize content changes with the React Flow state.
- Improved logging in edge removal to handle idempotent operations gracefully.
This commit is contained in:
Matthias
2026-03-26 17:35:25 +01:00
parent 824939307c
commit a5cde14573
6 changed files with 158 additions and 260 deletions

View File

@@ -82,15 +82,38 @@ export const remove = mutation({
args: { edgeId: v.id("edges") },
handler: async (ctx, { edgeId }) => {
const user = await requireAuth(ctx);
console.info("[edges.remove] request", {
edgeId,
userId: user.userId,
});
const edge = await ctx.db.get(edgeId);
if (!edge) throw new Error("Edge not found");
if (!edge) {
console.info("[edges.remove] edge already removed (idempotent no-op)", {
edgeId,
userId: user.userId,
});
return;
}
const canvas = await ctx.db.get(edge.canvasId);
if (!canvas || canvas.ownerId !== user.userId) {
console.warn("[edges.remove] unauthorized canvas access", {
edgeId,
canvasId: edge.canvasId,
userId: user.userId,
hasCanvas: Boolean(canvas),
});
throw new Error("Canvas not found");
}
await ctx.db.delete(edgeId);
await ctx.db.patch(edge.canvasId, { updatedAt: Date.now() });
console.info("[edges.remove] success", {
edgeId,
canvasId: edge.canvasId,
userId: user.userId,
});
},
});