Skip to content

Parse JSON LIST as LIST (not DICT) from JS when not using direct input slot #8127

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Amorano
Copy link
Contributor

@Amorano Amorano commented May 15, 2025

Problem:

With the new "input slots on widgets" system, during execution, only inputs (connected) are checked for values during the parse from Javascript frontend.

That means widgets, with no input, are not properly converted from their JSON return values. Since LIST types are mangled in the frontend into a dict entry of {value: [JSON LIST]} their values are passed, on execute, into the python functions as DICT, and not proper LISTs.

Soltion:

This is a patch to parse widget values not just input slot values. This allows inputs/widget values to serialize to a proper list (i.e. convert if the value is dict with a {"value"} entry) just like inputs.

patch to parse widget values not just input values. When widgets serialize as list on the JS side, they would never get converted back to list types (only if their input slot was connected to a value). This allows inputs/widget values to serialize to a proper list (i.e. convert if the value is dict with a {"value"} entry) just like inputs.
@Amorano Amorano requested a review from comfyanonymous as a code owner May 15, 2025 01:22
@Amorano Amorano changed the title Update execution.py Parse JSON LIST as LIST (not DICT) from JS when not using direct input slot May 15, 2025
@Amorano
Copy link
Contributor Author

Amorano commented May 16, 2025

A couple of images to explain in pictures what is happening.

Here you can see I am returning a tuple(0, 0) from the Vector node. This is serialized on the JS side as a simple JSON LIST. You can also see it is the value of the widget itself, not from something being plugged into the slot input.

image

Since this comes straight from the widget value itself, and is not from the output of another node passing the value through, the de-serialize during execute ignores the value (it only seems to parse values passed through input slots, not direct widget values serialized as LIST).

image

The output reads as a "DICT" and you can see it has the {"value": [0, 0]} instead of being converted back into a proper python list [0, 0].

@Amorano
Copy link
Contributor Author

Amorano commented May 27, 2025

Is there something missing from this that needs to be done to get it checked and pulled? This is a legitimate bug when not using direct linked inputs.

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.

1 participant