Repository navigation
fix: show the Image Crop preview after reopening a dynamic-input node #22384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0bd2d4d
test: cover the image crop preview after reopening a dynamic-input node
jaeone94 6e8229a
fix: find the Image Crop source by input type instead of slot 0
jaeone94 30b705d
fix: keep the Image Crop slot-0 fallback for inputs not typed IMAGE
jaeone94 719ef95
fix: match Image Crop sources that accept IMAGE, not only exact IMAGE
jaeone94 2aecdad
fix: keep Image Crop slot 0 on subgraph hosts
jaeone94 9922fa5
test: link the custom-type fallback fixture with a matching type
jaeone94 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
148 changes: 148 additions & 0 deletions
148
browser_tests/assets/widgets/image_crop_dynamic_inputs.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| { | ||
| "id": "dadf4878-8f8f-41bc-bf4a-53714aaeede1", | ||
| "revision": 0, | ||
| "last_node_id": 2, | ||
| "last_link_id": 1, | ||
| "nodes": [ | ||
| { | ||
| "id": 1, | ||
| "type": "LoadImage", | ||
| "pos": [50, 80], | ||
| "size": [282.798828125, 102], | ||
| "flags": {}, | ||
| "order": 0, | ||
| "mode": 0, | ||
| "inputs": [ | ||
| { | ||
| "localized_name": "image", | ||
| "name": "image", | ||
| "type": "COMBO", | ||
| "widget": { | ||
| "name": "image" | ||
| }, | ||
| "link": null | ||
| }, | ||
| { | ||
| "localized_name": "choose file to upload", | ||
| "name": "upload", | ||
| "type": "IMAGEUPLOAD", | ||
| "widget": { | ||
| "name": "upload" | ||
| }, | ||
| "link": null | ||
| } | ||
| ], | ||
| "outputs": [ | ||
| { | ||
| "localized_name": "IMAGE", | ||
| "name": "IMAGE", | ||
| "type": "IMAGE", | ||
| "links": [1] | ||
| }, | ||
| { | ||
| "localized_name": "MASK", | ||
| "name": "MASK", | ||
| "type": "MASK", | ||
| "links": null | ||
| } | ||
| ], | ||
| "properties": { | ||
| "Node name for S&R": "LoadImage" | ||
| }, | ||
| "widgets_values": ["example.png", "image"], | ||
| "widgets_values_named": { | ||
| "image": "example.png", | ||
| "upload": "image" | ||
| } | ||
| }, | ||
| { | ||
| "id": 2, | ||
| "type": "DynamicInputImageCrop", | ||
| "pos": [450, 80], | ||
| "size": [400, 500], | ||
| "flags": {}, | ||
| "order": 1, | ||
| "mode": 0, | ||
| "inputs": [ | ||
| { | ||
| "localized_name": "image_1", | ||
| "name": "model.images.image_1", | ||
| "type": "IMAGE", | ||
| "link": 1 | ||
| }, | ||
| { | ||
| "localized_name": "image_2", | ||
| "name": "model.images.image_2", | ||
| "shape": 7, | ||
| "type": "IMAGE", | ||
| "link": null | ||
| }, | ||
| { | ||
| "localized_name": "region", | ||
| "name": "model.region", | ||
| "type": "BOUNDING_BOX", | ||
| "widget": { | ||
| "name": "model.region" | ||
| }, | ||
| "link": null | ||
| }, | ||
| { | ||
| "localized_name": "model", | ||
| "name": "model", | ||
| "type": "COMFY_DYNAMICCOMBO_V3", | ||
| "widget": { | ||
| "name": "model" | ||
| }, | ||
| "link": null | ||
| } | ||
| ], | ||
| "outputs": [ | ||
| { | ||
| "localized_name": "IMAGE", | ||
| "name": "IMAGE", | ||
| "type": "IMAGE", | ||
| "links": null | ||
| } | ||
| ], | ||
| "properties": { | ||
| "Node name for S&R": "DynamicInputImageCrop" | ||
| }, | ||
| "widgets_values": [ | ||
| "Crop", | ||
| { | ||
| "x": 0, | ||
| "y": 0, | ||
| "width": 512, | ||
| "height": 512 | ||
| }, | ||
| 0, | ||
| 0, | ||
| 512, | ||
| 512 | ||
| ], | ||
| "widgets_values_named": { | ||
| "model": "Crop", | ||
| "model.region": { | ||
| "x": 0, | ||
| "y": 0, | ||
| "width": 512, | ||
| "height": 512 | ||
| }, | ||
| "x": 0, | ||
| "y": 0, | ||
| "width": 512, | ||
| "height": 512 | ||
| } | ||
| } | ||
| ], | ||
| "links": [[1, 1, 0, 2, 0, "IMAGE"]], | ||
| "groups": [], | ||
| "config": {}, | ||
| "extra": { | ||
| "ds": { | ||
| "scale": 1, | ||
| "offset": [0, 0] | ||
| } | ||
| }, | ||
| "version": 0.4 | ||
| } |
75 changes: 75 additions & 0 deletions
75
browser_tests/tests/vueNodes/widgets/imageCropDynamicInputs.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import { | ||
| comfyExpect as expect, | ||
| comfyPageFixture | ||
| } from '@e2e/fixtures/ComfyPage' | ||
| import type { ComfyNodeDef } from '@/schemas/nodeDefSchema' | ||
|
|
||
| const test = comfyPageFixture.extend({ | ||
| page: async ({ page }, use) => { | ||
| await page.route('**/object_info', async (route) => { | ||
| const response = await route.fetch() | ||
| const definitions: Record<string, ComfyNodeDef> = await response.json() | ||
| const cropNode: ComfyNodeDef = { | ||
| name: 'DynamicInputImageCrop', | ||
| display_name: 'Dynamic Input Image Crop', | ||
| category: 'testing', | ||
| python_module: 'nodes', | ||
| description: '', | ||
| input: { | ||
| required: { | ||
| model: [ | ||
| 'COMFY_DYNAMICCOMBO_V3', | ||
| { | ||
| options: [ | ||
| { | ||
| key: 'Crop', | ||
| inputs: { | ||
| required: { | ||
| images: [ | ||
| 'COMFY_AUTOGROW_V3', | ||
| { | ||
| template: { | ||
| input: { required: { image: ['IMAGE', {}] } }, | ||
| names: ['image_1', 'image_2'], | ||
| min: 1 | ||
| } | ||
| } | ||
| ], | ||
| region: ['BOUNDING_BOX', { component: 'ImageCrop' }] | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| output: ['IMAGE'], | ||
| output_name: ['IMAGE'], | ||
| output_node: false | ||
| } | ||
| await route.fulfill({ | ||
| response, | ||
| json: { ...definitions, [cropNode.name]: cropNode } | ||
| }) | ||
| }) | ||
| await use(page) | ||
| } | ||
| }) | ||
|
|
||
| test.describe( | ||
| 'Image Crop with dynamic inputs', | ||
| { tag: ['@widget', '@vue-nodes'] }, | ||
| () => { | ||
| test('shows the connected image after reopening a dynamic-input crop node', async ({ | ||
| comfyPage | ||
| }) => { | ||
| await comfyPage.workflow.loadWorkflow('widgets/image_crop_dynamic_inputs') | ||
|
|
||
| const cropNode = comfyPage.vueNodes.getNodeLocator('2') | ||
| await expect(cropNode).toBeVisible() | ||
| await expect.soft(cropNode.getByTestId('crop-overlay')).toBeVisible() | ||
| await expect.soft(cropNode.getByTestId('crop-empty-state')).toBeHidden() | ||
| }) | ||
| } | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High — This regression test links the image at target slot 1, but the diff contains no production change.
useImageCrop.tsstill callsresolveInputSourceNode(cropNode, IMAGE_INPUT_SLOT)withIMAGE_INPUT_SLOT = 0, and slot 0 is the unlinkedmodelinput here, soimageUrlstays null. That fails this test and the new E2E assertion inimageCropDynamicInputs.spec.ts(crop overlay visible / empty state hidden), and the bug itself is still there: a reopened dynamic-input crop node shows the empty state. Theinputsarrays added to every mock are also unused by the current source. Resolve the image slot by input type (for example, the first linkedIMAGEinput) inuseImageCrop.tsbefore merging. If this is meant as the red step of a red-then-green sequence, the fix still has to land in this PR. Raised by 4 of 6 reviewers (claude-opus-5-5-xhigh adversarial, gpt-5.6-sol-xhigh adversarial, claude-opus-5-5-xhigh edge-case, kimi-k3-high edge-case).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed by 6e8229a. That was the test-only red commit on purpose; the fix resolves the first
IMAGEinput and the new tests pass in CI. The "first linked" variant is not adopted: it keeps the input a freshly created node used (see the round 2 thread).