Skip to content

Conversation

@deon-sanchez
Copy link
Collaborator

@deon-sanchez deon-sanchez commented Dec 17, 2025

This pull request updates the sizing logic and minimum constraints for Note nodes in the frontend, making note sizing more consistent and flexible. The changes introduce a new DEFAULT_NOTE_SIZE constant, reduce the minimum allowed size for Note nodes, and update how node dimensions are handled and rendered. Additionally, the .secrets.baseline file is updated to reflect line number changes and a new generation timestamp.

Note node sizing and behavior improvements:

  • Introduced DEFAULT_NOTE_SIZE and reduced NOTE_NODE_MIN_WIDTH to 260 and NOTE_NODE_MIN_HEIGHT to 100 in constants.ts, making notes more flexible in size.
  • Updated NoteNode to use width and height directly from node data (falling back to DEFAULT_NOTE_SIZE), and set explicit width and height styles instead of minWidth/minHeight. Also, the resizer now uses the new minimum sizes. [1] [2] [3] [4] [5]
  • Updated PageComponent to use DEFAULT_NOTE_SIZE for the shadow box dimensions and to set new notes' initial width and height to DEFAULT_NOTE_SIZE. [1] [2] [3]

Original PR

#10149

@deon-sanchez deon-sanchez self-assigned this Dec 17, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This PR refactors note node sizing to use explicit width and height properties instead of measured dimensions. It introduces a DEFAULT_NOTE_SIZE constant (324px), reduces minimum dimensions (MIN_WIDTH to 260, MIN_HEIGHT to 100), updates the NoteNodeType interface to include width and height fields, and adjusts component logic to respect these new explicit sizing properties.

Changes

Cohort / File(s) Summary
Sizing constants
.secrets.baseline, src/frontend/src/constants/constants.ts
Updated Secret Keyword line number references and timestamp in baseline. Changed NOTE_NODE_MIN_WIDTH from 324 to 260 and NOTE_NODE_MIN_HEIGHT from 324 to 100. Introduced new DEFAULT_NOTE_SIZE export with value 324.
NoteNode component
src/frontend/src/CustomNodes/NoteNode/index.tsx
Imported DEFAULT_NOTE_SIZE from constants. Switched node dimension source from nodeData.measured.width/height to nodeData.width/height. Updated NodeResizer minWidth/minHeight to use fixed NOTE_NODE_MIN_* values. Modified rendered node style to use explicit width/height instead of minWidth/minHeight.
PageComponent
src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
Updated shadow box sizing to use DEFAULT_NOTE_SIZE scaled by zoom. Set explicit width and height to DEFAULT_NOTE_SIZE when creating new note nodes. Updated NoteNodeType interface to include width: number and height: number properties.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Consistency check: Verify that all note node creation paths properly set the explicit width/height fields aligned with DEFAULT_NOTE_SIZE.
  • Dimension validation: Confirm that the new minimum dimensions (260×100) are intentional and work correctly with the UI layout.
  • Type propagation: Ensure NoteNodeType changes are reflected across all consumers of note node data.

Pre-merge checks and finishing touches

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 3 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR introduces sticky notes functionality changes (new constants, component refactoring, interface updates) without adding or updating test files to verify the changes. Add or update test files to cover new sizing constants, width/height handling changes, minimum sizing limits, NoteNodeType interface changes, and integration tests for shadow box sizing.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Test Quality And Coverage ⚠️ Warning PR introduces significant sizing behavior changes without adding any unit or integration tests. Add unit tests for new constants, NoteNode bounds enforcement, PageComponent sizing, and E2E tests for minimum dimension constraints.
Test File Naming And Structure ⚠️ Warning PR introduces functional changes (DEFAULT_NOTE_SIZE, sizing constants, dimension handling) without corresponding test coverage in existing test files or Playwright integration tests. Add unit tests for sizing constants and dimension logic in note-node-utils.test.ts; update integration tests to verify new sizing behavior end-to-end.
Excessive Mock Usage Warning ❓ Inconclusive No pull request context, repository structure, test files, or mock usage data available for assessment. Provide the pull request details, modified/created test files, and mock usage patterns to evaluate excessive mock usage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: Improvements to Sticky Notes' directly relates to the main changes, which focus on sticky note sizing and rendering improvements across multiple components.

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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 17, 2025

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 17%
16.86% (4750/28164) 10.28% (2241/21786) 11.12% (688/6183)

Unit Test Results

Tests Skipped Failures Errors Time
1840 0 💤 0 ❌ 0 🔥 24.669s ⏱️

@github-actions github-actions bot added the enhancement New feature or request label Dec 17, 2025
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.04%. Comparing base (4a3462a) to head (1ecf21d).

Files with missing lines Patch % Lines
.../pages/FlowPage/components/PageComponent/index.tsx 0.00% 2 Missing ⚠️

❌ Your project check has failed because the head coverage (38.80%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11057      +/-   ##
==========================================
- Coverage   33.21%   33.04%   -0.18%     
==========================================
  Files        1391     1390       -1     
  Lines       65849    65464     -385     
  Branches     9745     9658      -87     
==========================================
- Hits        21873    21631     -242     
+ Misses      42854    42711     -143     
  Partials     1122     1122              
Flag Coverage Δ
frontend 15.52% <71.42%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/frontend/src/CustomNodes/NoteNode/index.tsx 50.00% <100.00%> (+50.00%) ⬆️
src/frontend/src/constants/constants.ts 95.38% <100.00%> (+0.02%) ⬆️
.../pages/FlowPage/components/PageComponent/index.tsx 0.00% <0.00%> (ø)

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@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)
src/frontend/src/constants/constants.ts (1)

885-887: Consider whether MIN_HEIGHT=100 is appropriate for note usability.

The separation of minimum dimensions (260x100) from default size (324) is architecturally sound and enables flexible note sizing. However, NOTE_NODE_MIN_HEIGHT = 100 allows notes to be resized to just 100px tall, which may be too small for practical use.

Consider whether a slightly larger minimum height (e.g., 150-200) would prevent users from accidentally creating unusably small notes while still providing resizing flexibility. If 100px is intentional for compact notes, this can be disregarded.

-export const NOTE_NODE_MIN_HEIGHT = 100;
+export const NOTE_NODE_MIN_HEIGHT = 150;  // Adjust if 100px is too small
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abc9c81 and a5d0c62.

📒 Files selected for processing (4)
  • .secrets.baseline (2 hunks)
  • src/frontend/src/CustomNodes/NoteNode/index.tsx (4 hunks)
  • src/frontend/src/constants/constants.ts (1 hunks)
  • src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)

src/frontend/src/**/*.{ts,tsx}: Use React 18 with TypeScript for frontend development
Use Zustand for state management

Files:

  • src/frontend/src/constants/constants.ts
  • src/frontend/src/CustomNodes/NoteNode/index.tsx
  • src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
src/frontend/src/**/*.{tsx,jsx,css,scss}

📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)

Use Tailwind CSS for styling

Files:

  • src/frontend/src/CustomNodes/NoteNode/index.tsx
  • src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
src/frontend/src/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)

src/frontend/src/**/*.{tsx,jsx}: Implement dark mode support using the useDarkMode hook and dark store
Use Lucide React for icon components in the application

Files:

  • src/frontend/src/CustomNodes/NoteNode/index.tsx
  • src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
🧠 Learnings (5)
📚 Learning: 2025-11-24T19:46:45.790Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-11-24T19:46:45.790Z
Learning: Applies to src/frontend/src/components/nodes/**/*.{tsx,jsx} : Memoize custom React Flow node components using memo() to prevent unnecessary re-renders

Applied to files:

  • src/frontend/src/CustomNodes/NoteNode/index.tsx
  • src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
📚 Learning: 2025-11-24T19:46:45.790Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-11-24T19:46:45.790Z
Learning: Applies to src/frontend/src/components/**/*.{tsx,jsx} : Use React Flow for flow graph visualization with Node, Edge, Controls, and Background components

Applied to files:

  • src/frontend/src/CustomNodes/NoteNode/index.tsx
  • src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
📚 Learning: 2025-06-23T12:46:42.048Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: Custom React Flow node types should be implemented as memoized components, using Handle components for connection points and supporting optional icons and labels.

Applied to files:

  • src/frontend/src/CustomNodes/NoteNode/index.tsx
  • src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Export custom icon components in React using React.forwardRef to ensure proper ref forwarding and compatibility with parent components.

Applied to files:

  • src/frontend/src/CustomNodes/NoteNode/index.tsx
📚 Learning: 2025-06-23T12:46:42.048Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: React Flow should be used for flow graph visualization, with nodes and edges passed as props, and changes handled via onNodesChange and onEdgesChange callbacks.

Applied to files:

  • src/frontend/src/CustomNodes/NoteNode/index.tsx
  • src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
🧬 Code graph analysis (2)
src/frontend/src/CustomNodes/NoteNode/index.tsx (1)
src/frontend/src/constants/constants.ts (3)
  • DEFAULT_NOTE_SIZE (887-887)
  • NOTE_NODE_MIN_WIDTH (885-885)
  • NOTE_NODE_MIN_HEIGHT (886-886)
src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx (1)
src/frontend/src/constants/constants.ts (1)
  • DEFAULT_NOTE_SIZE (887-887)
🪛 Gitleaks (8.30.0)
.secrets.baseline

[high] 1412-1412: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 1420-1420: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ 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). (4)
  • GitHub Check: Run Frontend Unit Tests / Frontend Jest Unit Tests
  • GitHub Check: Run Frontend Tests / Determine Test Suites and Shard Distribution
  • GitHub Check: Test Docker Images / Test docker images
  • GitHub Check: Test Starter Templates
🔇 Additional comments (8)
.secrets.baseline (1)

1406-1422: LGTM! Routine secrets baseline maintenance.

The line number updates correctly reflect the addition of new constants in src/frontend/src/constants/constants.ts. The static analysis hints flagged by Gitleaks appear to be the same entries that existed before (based on matching hashed_secret values), just at new line positions.

Also applies to: 1531-1531

src/frontend/src/CustomNodes/NoteNode/index.tsx (4)

6-6: LGTM! Centralized default size constant.

Importing DEFAULT_NOTE_SIZE from constants provides a single source of truth for the default note dimensions.


149-150: Correct use of minimum dimensions for resizer constraints.

Using NOTE_NODE_MIN_WIDTH (260) and NOTE_NODE_MIN_HEIGHT (100) directly allows notes to be resized smaller than the default size (324), which is the intended behavior. The previous Math.max approach would have prevented resizing below the default.


165-166: Proper use of explicit dimensions for controlled sizing.

Rendering with explicit width and height (rather than minWidth/minHeight) ensures the node displays at the exact dimensions stored in state, which is essential for the explicit sizing approach introduced in this PR.


106-107: The switch from measured to explicit dimensions is correct and requires no changes.

All code paths properly initialize note node dimensions:

  • New notes created via PageComponent: width/height explicitly set to DEFAULT_NOTE_SIZE
  • Duplicated notes via paste(): width/height use the fallback to DEFAULT_NOTE_SIZE (note: duplicated notes reset to default size)
  • Flow loading: nodes loaded from API retain their stored dimensions
  • Missing dimensions: fallback to DEFAULT_NOTE_SIZE provides backward compatibility

The implementation is safe and handles edge cases appropriately.

src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx (3)

27-27: LGTM! Import added for new sizing constant.

The DEFAULT_NOTE_SIZE import supports the explicit sizing changes throughout this file.


165-166: Improved preview sizing for note placement.

Using DEFAULT_NOTE_SIZE (324) for the shadow box preview is better UX than using the minimum dimensions (260x100), as it shows users the actual size the note will be created at. This is a sensible functional improvement.


660-661: Essential initialization of explicit dimensions for new notes.

Setting explicit width and height properties when creating new note nodes ensures the state correctly reflects the node's dimensions from creation. This is critical for the explicit sizing approach and enables proper persistence and synchronization.

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 17, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 17, 2025
export const NOTE_NODE_MIN_WIDTH = 324;
export const NOTE_NODE_MIN_HEIGHT = 324;
export const NOTE_NODE_MIN_WIDTH = 260;
export const NOTE_NODE_MIN_HEIGHT = 100;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these min numbers come from product.

Copy link
Collaborator

@viktoravelino viktoravelino left a comment

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions bot added the lgtm This PR has been approved by a maintainer label Dec 17, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 17, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 17, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 17, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 18, 2025
@deon-sanchez deon-sanchez added this pull request to the merge queue Dec 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 18, 2025
@deon-sanchez deon-sanchez added this pull request to the merge queue Dec 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 18, 2025
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants