Comfy-Org / Comfy-Org/ComfyUI_frontend

feat: expand widget null-value sanitization to non-numeric widget types in LGraphNode.configure

Open
#11,983 0 comments 0 reactions 1 assignee Claimed by @kaili-yang View on GitHub
area:nodes area:widgets
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

During PR #11884 (fix: sanitize null/NaN widget values when loading workflows), null/NaN sanitization in `LGraphNode.configure()` was intentionally scoped to **numeric widget types** (`number`, `slider`, `knob`, `gradientslider`).

A TODO comment was added in the test file (`src/lib/litegraph/src/LGraphNode.configure.test.ts`) noting that the behavior for non-numeric widgets (e.g. `text`) — where a serialized `null` from `widgets_values` clobbers the widget's default — is the same shape of bug, but was left as a follow-up.

## Context

- **Root cause**: `LGraphNode.configure()` assigns values from `widgets_values` without guarding against `null`/`undefined` for any widget type.
- **Current fix** (PR #11884): Skips assignment for numeric widgets when the incoming value is `null`/`undefined`/non-finite.
- **Remaining gap**: For non-numeric widgets (e.g. `text`, `combo`, `toggle`), a serialized `null` will still overwrite the widget's default value. Whether `null` in `widgets_values` is ever an intentional value for these types needs clarification before expanding the guard.

## Proposed work

1. Audit all non-numeric widget types to determine whether `null` is ever a meaningful/intentional stored value.
2. If not, expand the `incoming == null` guard in `configure()` to cover all widget types (or a broader subset).
3. Update `isNumericWidget` or introduce a more general predicate as appropriate.
4. Flip or update the test `does not sanitize null for non-numeric widget types` accordingly.

## References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11884
- Discussion comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11884#discussion_r3184017272
- Requested by: @DrJKL

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11983-feat-expand-widget-null-value-sanitization-to-non-numeric-widget-types-in-LGraphNode-3576d73d36508174a4aac95cf202aac9) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.