Skip to content

Conversation

@CH1111
Copy link
Contributor

@CH1111 CH1111 commented Dec 19, 2025

  • Implemented z-index management for nodes in the Flow component based on the selected node.
  • Removed the useSelectedNodeZIndex hook from various node components to streamline logic and improve performance.
  • Updated the prepareAddNode utility to conditionally connect nodes based on their type.
  • Ensured compliance with coding standards, including optional chaining and nullish coalescing for safer property access.

Summary by CodeRabbit

  • Refactor

    • Optimized canvas node layering system by centralizing z-index management, ensuring selected nodes properly display in the foreground.
  • New Features/Changes

    • Memo-type nodes now have independent connection behavior and no longer automatically connect to the start node by default.

✏️ Tip: You can customize this high-level summary in your review settings.

- Implemented z-index management for nodes in the Flow component based on the selected node.
- Removed the useSelectedNodeZIndex hook from various node components to streamline logic and improve performance.
- Updated the prepareAddNode utility to conditionally connect nodes based on their type.
- Ensured compliance with coding standards, including optional chaining and nullish coalescing for safer property access.
@coderabbitai
Copy link

coderabbitai bot commented Dec 19, 2025

Walkthrough

Centralizes z-index management from individual node hooks to a shared Flow component effect; removes the distributed useSelectedNodeZIndex hook from 10 node types; adds special handling for memo nodes in orphan detection and auto-connect logic; memo nodes reset z-index to 0 independently.

Changes

Cohort / File(s) Change Summary
Node component hook removals
packages/ai-workspace-common/src/components/canvas/nodes/audio.tsx, code-artifact.tsx, document.tsx, group.tsx, image.tsx, resource.tsx, skill-response.tsx, video.tsx, website.tsx
Removed useSelectedNodeZIndex hook import and invocation from each node component, delegating z-index management to the centralized Flow component effect.
Start node updates
packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
Removed useSelectedNodeZIndex hook; updated hover event handlers to pass selected state and dependency arrays to include it.
Memo node z-index handling
packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
Added setNodes destructure from React Flow hook; reset active node's zIndex to 0 during component setup and event handler initialization.
Flow component centralized z-index effect
packages/ai-workspace-common/src/components/canvas/index.tsx
Added effect that mutates node styles: selected node receives zIndex 1000, others 1 (memo nodes 0), triggered by selectedNode?.id or reactFlowInstance changes.
Removed z-index hook
packages/ai-workspace-common/src/hooks/canvas/use-selected-node-zIndex.tsx
Deleted hook that previously managed per-node z-index based on selection state.
Orphan node processing
packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
Added logic to disconnect memo-type nodes from start and skip further orphan processing for them.
Memo auto-connect skip
packages/canvas-common/src/utils.ts
Modified auto-connect logic to exclude memo nodes from automatically connecting to the start node when connectTo is not provided.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas requiring extra attention:
    • Verify the centralized Flow effect correctly replaces all z-index logic previously distributed across 10 node components
    • Confirm memo node z-index reset (0) does not conflict with centralized effect logic (which also targets memo nodes)
    • Validate memo node special handling in orphan processing and auto-connect logic does not create unintended behavioral gaps
    • Check that selected state propagation in start.tsx hover handlers aligns with updated hover event semantics

Possibly related PRs

Suggested reviewers

  • mrcfps
  • anthhub

Poem

🐰 A tale of layers, brought to light,
From scattered hooks to centralized height,
Each node once managed its own z-quest,
Now Flow commands them—layer's blessed!
Memos stand apart, with zero's crown,

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main refactoring effort: consolidating z-index management from individual node hooks into a centralized effect in the Flow component, and removing the now-unused useSelectedNodeZIndex hook.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/lower-note-zindex

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx (1)

400-407: Consider separating z-index reset into a dedicated effect.

The z-index reset logic is currently embedded in the event handler registration effect (lines 381-420), mixing two distinct concerns. This could lead to unnecessary z-index resets whenever any of the event handler dependencies change.

🔎 Proposed refactor to separate concerns

Move the z-index reset into its own effect that runs only once on mount:

+  // Reset z-index for memo nodes on mount
+  useEffect(() => {
+    setNodes((nodes) =>
+      nodes.map((n) => {
+        if (n.id === id) {
+          return { ...n, style: { ...n.style, zIndex: 0 } };
+        }
+        return n;
+      }),
+    );
+  }, [id, setNodes]);
+
   // Add event handling
   useEffect(() => {
     // Create node-specific event handlers
     const handleNodeAddToContext = () => handleAddToContext();
     const handleNodeDelete = () => handleDelete();
     const handleNodeInsertToDoc = () => handleInsertToDoc();
     const handleNodeAskAI = (event?: {
       dragCreateInfo?: NodeDragCreateInfo;
     }) => handleAskAI(event);
     const handleNodeDuplicate = (event?: {
       dragCreateInfo?: NodeDragCreateInfo;
     }) => handleDuplicate(event);

     // Register events with node ID
     nodeActionEmitter.on(createNodeEventName(id, 'addToContext'), handleNodeAddToContext);
     nodeActionEmitter.on(createNodeEventName(id, 'delete'), handleNodeDelete);
     nodeActionEmitter.on(createNodeEventName(id, 'insertToDoc'), handleNodeInsertToDoc);
     nodeActionEmitter.on(createNodeEventName(id, 'askAI'), handleNodeAskAI);
     nodeActionEmitter.on(createNodeEventName(id, 'duplicate'), handleNodeDuplicate);

-    setNodes((nodes) =>
-      nodes.map((n) => {
-        if (n.id === id) {
-          return { ...n, style: { ...n.style, zIndex: 0 } };
-        }
-        return n;
-      }),
-    );
-
     return () => {
       // Cleanup events when component unmounts
       nodeActionEmitter.off(createNodeEventName(id, 'addToContext'), handleNodeAddToContext);
       nodeActionEmitter.off(createNodeEventName(id, 'delete'), handleNodeDelete);
       nodeActionEmitter.off(createNodeEventName(id, 'insertToDoc'), handleNodeInsertToDoc);
       nodeActionEmitter.off(createNodeEventName(id, 'askAI'), handleNodeAskAI);
       nodeActionEmitter.off(createNodeEventName(id, 'duplicate'), handleNodeDuplicate);

       // Clean up all node events
       cleanupNodeEvents(id);
     };
   }, [id, handleAddToContext, handleDelete, handleInsertToDoc, handleAskAI, handleDuplicate]);

This improves maintainability by:

  • Separating z-index initialization from event handling
  • Ensuring z-index is only reset once on mount (or when id/setNodes change)
  • Making the event registration effect focus solely on event handler lifecycle

Based on learnings, extract complex logic into custom hooks or separate effects for better code organization.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79adcd7 and 2bc117d.

📒 Files selected for processing (15)
  • packages/ai-workspace-common/src/components/canvas/index.tsx (1 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/audio.tsx (0 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/code-artifact.tsx (0 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/document.tsx (0 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/group.tsx (0 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/image.tsx (0 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx (2 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/resource.tsx (0 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/skill-response.tsx (0 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx (1 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/video.tsx (0 hunks)
  • packages/ai-workspace-common/src/components/canvas/nodes/website.tsx (0 hunks)
  • packages/ai-workspace-common/src/hooks/canvas/use-selected-node-zIndex.tsx (0 hunks)
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts (1 hunks)
  • packages/canvas-common/src/utils.ts (1 hunks)
💤 Files with no reviewable changes (10)
  • packages/ai-workspace-common/src/components/canvas/nodes/video.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/document.tsx
  • packages/ai-workspace-common/src/hooks/canvas/use-selected-node-zIndex.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/skill-response.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/resource.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/website.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/group.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/audio.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/image.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/code-artifact.tsx
🧰 Additional context used
📓 Path-based instructions (20)
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,jsx,tsx}: Always use optional chaining (?.) when accessing object properties
Always use nullish coalescing (??) or default values for potentially undefined values
Always check array existence before using array methods
Always validate object properties before destructuring
Always use single quotes for string literals in JavaScript/TypeScript code

**/*.{js,ts,jsx,tsx}: Use semicolons at the end of statements
Include spaces around operators (e.g., a + b instead of a+b)
Always use curly braces for control statements
Place opening braces on the same line as their statement

**/*.{js,ts,jsx,tsx}: Group import statements in order: React/framework libraries, third-party libraries, internal modules, relative path imports, type imports, style imports
Sort imports alphabetically within each import group
Leave a blank line between import groups
Extract complex logic into custom hooks
Use functional updates for state (e.g., setCount(prev => prev + 1))
Split complex state into multiple state variables rather than single large objects
Use useReducer for complex state logic instead of multiple useState calls

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{js,ts,tsx,jsx,py,java,cpp,c,cs,rb,go,rs,php,swift,kt,scala,r,m,mm,sql}

📄 CodeRabbit inference engine (.cursor/rules/00-language-priority.mdc)

**/*.{js,ts,tsx,jsx,py,java,cpp,c,cs,rb,go,rs,php,swift,kt,scala,r,m,mm,sql}: All code comments MUST be written in English
All variable names, function names, class names, and other identifiers MUST use English words
Comments should be concise and explain 'why' rather than 'what'
Use proper grammar and punctuation in comments
Keep comments up-to-date when code changes
Document complex logic, edge cases, and important implementation details
Use clear, descriptive names that indicate purpose
Avoid abbreviations unless they are universally understood

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/00-language-priority.mdc)

Use JSDoc style comments for functions and classes in JavaScript/TypeScript

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/01-code-style.mdc)

**/*.{js,jsx,ts,tsx}: Use single quotes for string literals in TypeScript/JavaScript
Always use optional chaining (?.) when accessing object properties in TypeScript/JavaScript
Always use nullish coalescing (??) or default values for potentially undefined values in TypeScript/JavaScript
Always check array existence before using array methods in TypeScript/JavaScript
Validate object properties before destructuring in TypeScript/JavaScript
Use ES6+ features like arrow functions, destructuring, and spread operators in TypeScript/JavaScript
Avoid magic numbers and strings - use named constants in TypeScript/JavaScript
Use async/await instead of raw promises for asynchronous code in TypeScript/JavaScript

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/03-typescript-guidelines.mdc)

**/*.{ts,tsx}: Avoid using any type whenever possible - use unknown type instead with proper type guards
Always define explicit return types for functions, especially for public APIs
Prefer extending existing types over creating entirely new types
Use TypeScript utility types (Partial<T>, Pick<T, K>, Omit<T, K>, Readonly<T>, Record<K, T>) to derive new types
Use union types and intersection types to combine existing types
Always import types explicitly using the import type syntax
Group type imports separately from value imports
Minimize creating local type aliases for imported types

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{js,ts,jsx,tsx,css,json}

📄 CodeRabbit inference engine (.cursor/rules/04-code-formatting.mdc)

Maximum line length of 100 characters

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{js,ts,jsx,tsx,css,json,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/04-code-formatting.mdc)

Use 2 spaces for indentation, no tabs

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{js,ts,jsx,tsx,css,json,yml,yaml,md}

📄 CodeRabbit inference engine (.cursor/rules/04-code-formatting.mdc)

No trailing whitespace at the end of lines

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{css,scss,sass,less,js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/09-design-system.mdc)

**/*.{css,scss,sass,less,js,jsx,ts,tsx}: Primary color (#155EEF) should be used for main brand color in buttons, links, and accents
Error color (#F04438) should be used for error states and destructive actions
Success color (#12B76A) should be used for success states and confirmations
Warning color (#F79009) should be used for warnings and important notifications
Info color (#0BA5EC) should be used for informational elements

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)

**/*.{tsx,ts}: Use the translation wrapper component and useTranslation hook in components
Ensure all user-facing text is translatable

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{tsx,ts,json}

📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)

Support dynamic content with placeholders in translations

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{tsx,ts,jsx,js,vue,css,scss,less}

📄 CodeRabbit inference engine (.cursor/rules/11-ui-design-patterns.mdc)

**/*.{tsx,ts,jsx,js,vue,css,scss,less}: Use the primary blue (#155EEF) for main UI elements, CTAs, and active states
Use red (#F04438) only for errors, warnings, and destructive actions
Use green (#12B76A) for success states and confirmations
Use orange (#F79009) for warning states and important notifications
Use blue (#0BA5EC) for informational elements
Primary buttons should be solid with the primary color
Secondary buttons should have a border with transparent or light background
Danger buttons should use the error color
Use consistent padding, border radius, and hover states for all buttons
Follow fixed button sizes based on their importance and context
Use consistent border radius (rounded-lg) for all cards
Apply light shadows (shadow-sm) for card elevation
Maintain consistent padding inside cards (p-4 or p-6)
Use subtle borders for card separation
Ensure proper spacing between card elements
Apply consistent styling to all form inputs
Use clear visual indicators for focus, hover, and error states in form elements
Apply proper spacing between elements using 8px, 16px, 24px increments
Ensure proper alignment of elements (left, center, or right)
Use responsive layouts that work across different device sizes
Maintain a minimum contrast ratio of 4.5:1 for text

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{tsx,ts,jsx,js,vue}

📄 CodeRabbit inference engine (.cursor/rules/11-ui-design-patterns.mdc)

**/*.{tsx,ts,jsx,js,vue}: Include appropriate loading states for async actions in buttons
Group related form elements with appropriate spacing
Provide clear validation feedback for forms
Ensure proper labeling and accessibility for form elements
Ensure all interactive elements are keyboard accessible
Include appropriate ARIA attributes for complex components
Provide alternative text for images and icons
Support screen readers with semantic HTML elements

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/08-contributing-guidelines.mdc)

**/*.{ts,tsx,js,jsx}: Follow the TypeScript/JavaScript style guidelines
Ensure code is well-tested and documented

Files:

  • packages/canvas-common/src/utils.ts
  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
  • packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{jsx,tsx}: Always use tailwind css to style the component
Always wrap pure components with React.memo to prevent unnecessary re-renders
Always use useMemo for expensive computations or complex object creation
Always use useCallback for function props to maintain referential equality
Always specify proper dependency arrays in useEffect to prevent infinite loops
Always avoid inline object/array creation in render to prevent unnecessary re-renders
Always use proper key props when rendering lists
Always split nested components with closures into separate components to avoid performance issues and improve code maintainability

**/*.{jsx,tsx}: Always wrap pure components with React.memo to prevent unnecessary re-renders
Always use useMemo for expensive computations or complex object creation in React
Always use useCallback for function props to maintain referential equality in React
Always specify proper dependency arrays in useEffect to prevent infinite loops in React
Always avoid inline object/array creation in render to prevent unnecessary re-renders in React
Always use proper key props when rendering lists in React (avoid using index when possible)
Always split nested components with closures into separate components in React
Use lazy loading for components that are not immediately needed in React
Debounce handlers for events that might fire rapidly (resize, scroll, input) in React
Implement fallback UI for components that might fail in React
Use error boundaries to catch and handle runtime errors in React

**/*.{jsx,tsx}: Place each attribute on a new line when a component has multiple attributes in JSX
Use self-closing tags for elements without children in JSX
Keep JSX expressions simple, extract complex logic to variables
Put closing brackets for multi-line JSX on a new line

**/*.{jsx,tsx}: Component file names should match the component name
Organize function components in order: imports, type definitions, constants, component function, hook calls, e...

Files:

  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
**/*.{jsx,tsx,css}

📄 CodeRabbit inference engine (.cursor/rules/01-code-style.mdc)

**/*.{jsx,tsx,css}: Use Tailwind CSS for styling components
Follow the utility-first approach with Tailwind CSS
Group related utility classes together in Tailwind CSS
Prefer Tailwind utilities over custom CSS when possible

Files:

  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
**/*.{jsx,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/05-code-organization.mdc)

Each component file should contain only one main component

Files:

  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/05-code-organization.mdc)

Explicitly type props with interfaces or types in React components

Files:

  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/08-contributing-guidelines.mdc)

Use React best practices for frontend code

Files:

  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
  • packages/ai-workspace-common/src/components/canvas/index.tsx
  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
**/index.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/05-code-organization.mdc)

Use index files to export multiple components from a directory

Files:

  • packages/ai-workspace-common/src/components/canvas/index.tsx
🧠 Learnings (4)
📚 Learning: 2025-11-25T03:04:05.715Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/05-code-organization.mdc:0-0
Timestamp: 2025-11-25T03:04:05.715Z
Learning: Applies to **/*.{js,ts,jsx,tsx} : Extract complex logic into custom hooks

Applied to files:

  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
📚 Learning: 2025-11-25T03:04:05.715Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/05-code-organization.mdc:0-0
Timestamp: 2025-11-25T03:04:05.715Z
Learning: Applies to **/*.{jsx,tsx} : Use context for sharing state across multiple components

Applied to files:

  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
📚 Learning: 2025-11-25T03:04:05.715Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/05-code-organization.mdc:0-0
Timestamp: 2025-11-25T03:04:05.715Z
Learning: Extract repeated JSX patterns into reusable components

Applied to files:

  • packages/ai-workspace-common/src/components/canvas/nodes/start.tsx
📚 Learning: 2025-11-25T03:03:31.945Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/01-code-style.mdc:0-0
Timestamp: 2025-11-25T03:03:31.945Z
Learning: Applies to **/*.{jsx,tsx} : Always wrap pure components with React.memo to prevent unnecessary re-renders

Applied to files:

  • packages/ai-workspace-common/src/components/canvas/nodes/memo/memo.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build / Build
🔇 Additional comments (5)
packages/canvas-common/src/utils.ts (1)

73-73: LGTM! Memo node exclusion from auto-connect is consistent with the broader architecture.

The conditional logic correctly prevents memo nodes from automatically connecting to the start node, aligning with the special handling of memo nodes throughout this PR (orphan-node disconnection, z-index management).

packages/ai-workspace-common/src/hooks/use-handle-orphan-node.ts (1)

78-81: LGTM! Memo node handling is clear and aligns with the PR's architectural changes.

The early-exit pattern cleanly ensures memo nodes are disconnected from the start node and skip further orphan processing, consistent with the memo-specific behavior introduced across this PR.

packages/ai-workspace-common/src/components/canvas/nodes/start.tsx (2)

114-116: LGTM! Hover handler correctly passes selected state and dependencies are accurate.

The updated onHoverStart call now includes the selected state, and the dependency array properly includes selected to avoid stale closures.


121-123: LGTM! Hover handler correctly passes selected state and dependencies are accurate.

The updated onHoverEnd call now includes the selected state, and the dependency array properly includes selected to avoid stale closures.

packages/ai-workspace-common/src/components/canvas/index.tsx (1)

1079-1095: LGTM! Centralized z-index management successfully replaces per-node hooks.

The effect correctly applies z-index styling to bring the selected node to the foreground (z-index 1000) while keeping others at z-index 1. Memo nodes are appropriately skipped, maintaining their independent z-index handling.

The dependency array includes reactFlowInstance, which is a stable reference from useReactFlow, so it won't cause unnecessary re-renders.

@mrcfps mrcfps merged commit 27e4824 into main Dec 19, 2025
2 checks passed
@mrcfps mrcfps deleted the fix/lower-note-zindex branch December 19, 2025 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants