Files
ComfyUI_frontend/.claude/skills/adding-deprecation-warnings/SKILL.md
Christian Byrne dc09eb60e4 fix: add deprecation warning for widget.inputEl on STRING multiline widgets (#9808)
## Summary

Add a deprecation warning when custom nodes access `widget.inputEl` on
STRING multiline widgets, directing them to use `widget.element`
instead.

## Changes

- **What**: Add a reusable `defineDeprecatedProperty` helper in
`feedback.ts` that creates an ODP getter/setter proxy from a deprecated
property to its replacement, logging via the existing `warnDeprecated`
utility (deduplicates: warns once per unique message per session). Use
it to deprecate `widget.inputEl` → `widget.element`.

## Review Focus

- `defineDeprecatedProperty` is generic and can be reused for future
property deprecations across the codebase.
- `warnDeprecated` already handles deduplication via a `Set`, so heavy
access patterns (e.g. custom nodes reading `widget.inputEl` in tight
loops) won't spam.
- `enumerable: false` keeps the deprecated alias out of `Object.keys()`
/ `for...in` / `JSON.stringify`.

Fixes Comfy-Org/ComfyUI#12893

<!-- Pipeline-Ticket: 6b291ba2-694c-42d6-ac0c-fcbdcba9373a -->

---------

Co-authored-by: Dante <bunggl@naver.com>
2026-03-28 13:24:49 -07:00

3.0 KiB

name, description
name description
adding-deprecation-warnings Adds deprecation warnings for renamed or removed properties/APIs. Searches custom node ecosystem for usage, applies defineDeprecatedProperty helper, adds JSDoc. Triggers on: deprecate, deprecation warning, rename property, backward compatibility.

Adding Deprecation Warnings

Adds backward-compatible deprecation warnings for renamed or removed properties using the defineDeprecatedProperty helper in src/lib/litegraph/src/utils/feedback.ts.

When to Use

  • A property or API has been renamed and custom nodes still use the old name
  • A property is being removed but needs a grace period
  • Backward compatibility must be preserved while nudging adoption

Steps

1. Search the Custom Node Ecosystem

Before implementing, assess impact by searching for usage of the deprecated property across ComfyUI custom nodes:

Use the comfy_codesearch tool to search for the old property name.
Search for both `widget.oldProp` and just `oldProp` to catch all patterns.

Document the usage patterns found (property access, truthiness checks, caching to local vars, style mutation, etc.) — these all must continue working.

2. Apply the Deprecation

Use defineDeprecatedProperty from src/lib/litegraph/src/utils/feedback.ts:

import { defineDeprecatedProperty } from '@/lib/litegraph/src/utils/feedback'

/** @deprecated Use {@link obj.newProp} instead. */
defineDeprecatedProperty(
  obj,
  'oldProp',
  'newProp',
  'obj.oldProp is deprecated. Use obj.newProp instead.'
)

3. Checklist

  • Ecosystem search completed — all usage patterns are compatible
  • defineDeprecatedProperty call added after the new property is assigned
  • JSDoc @deprecated tag added above the call for IDE support
  • Warning message names both old and new property clearly
  • pnpm typecheck passes
  • pnpm lint passes

4. PR Comment

Add a PR comment summarizing the ecosystem search results: which repos use the deprecated property, what access patterns were found, and confirmation that all patterns are compatible with the ODP getter/setter.

How defineDeprecatedProperty Works

  • Creates an Object.defineProperty getter/setter on the target object
  • Getter returns this[currentKey], setter assigns this[currentKey]
  • Both log via warnDeprecated, which deduplicates (once per unique message per session via a Set)
  • enumerable: false keeps the alias out of Object.keys() / for...in / JSON.stringify
  • configurable: true allows further redefinition if needed

Edge Cases

  • Truthiness checks (if (widget.oldProp)) — works, getter fires
  • Caching to local var (const el = widget.oldProp) — works, warns once then the cached ref is used directly
  • Style/property mutation (widget.oldProp.style.color = 'red') — works, getter returns the real object
  • Serialization (JSON.stringify) — enumerable: false excludes it
  • Heavy access in loopswarnDeprecated deduplicates, only warns once per session regardless of call count