Skip to content

Conversation

@CodeWithBehnam
Copy link
Owner

@CodeWithBehnam CodeWithBehnam commented Dec 25, 2025

Summary

Fixed bug where nodes wouldn't collapse properly when clicking the collapse button.

Changes:

  1. BaseNode.ts: Added collapsed state check to both onResize handlers (for image preview and regular resizable nodes)
  2. PromptNode.ts: Added onResize handler with collapsed check + collapsed check in onDrawForeground
  3. NegativePromptNode.ts: Added onResize handler with collapsed check + collapsed check in onDrawForeground
  4. SeedNode.ts: Added onResize handler with collapsed check + collapsed check in onDrawForeground
  5. ImageSourceNode.ts: Added onResize handler with collapsed check + collapsed check in onDrawForeground

Root Cause

When clicking the collapse button, LiteGraph tries to shrink the node size. However, the onResize handlers were enforcing minimum height constraints, immediately re-expanding the node and preventing it from collapsing. Additionally, onDrawForeground was drawing content even when collapsed.

Test Plan

  • TypeScript compiles without errors
  • ESLint passes
  • All 27 unit tests pass
  • Manual test: Verify all node types collapse properly (Prompt, Split Grid, Seed, Image Source, etc.)

Behnam Ebrahimi

Behnam added 2 commits December 25, 2025 17:44
When a node is collapsed, the onResize handler was enforcing minimum
height constraints, preventing LiteGraph from shrinking the node to
its collapsed state. This caused the image preview area to remain
visible even when collapsed.

Added collapsed state check at the start of both onResize handlers
to skip constraint enforcement when the node is collapsed.

Co-Authored-By: Behnam & Claude Code
Extended the collapse fix to all custom nodes that don't use
createNodeClass():
- PromptNode: Added onResize handler and collapsed check in onDrawForeground
- NegativePromptNode: Added onResize handler and collapsed check
- SeedNode: Added onResize handler and collapsed check
- ImageSourceNode: Added onResize handler and collapsed check

All nodes now properly collapse when clicking the collapse button.

Co-Authored-By: Behnam & Claude Code
@CodeWithBehnam CodeWithBehnam merged commit 39ea283 into main Dec 25, 2025
2 checks passed
@CodeWithBehnam CodeWithBehnam deleted the fix/collapsed-node-resize branch December 25, 2025 17:55
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.

2 participants