Comfy-Org / Comfy-Org/ComfyUI_frontend
Extract shared helper for promoted widget error-clearing orchestration
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
The promoted-widget error-clearing flow currently duplicates the same "clear source scope, then clear host scope" orchestration across multiple UI and graph surfaces. This was intentionally left local in #13059 to keep that PR focused, but it should be extracted into a shared helper to reduce drift and make the source-vs-host option contract explicit.
## Background
PR #13059 updated promoted missing-model handling so host/promoted widgets clear both:
- the promoted source scope, and
- the host widget scope
That sequence now exists in multiple places:
- `src/renderer/extensions/vueNodes/composables/useProcessedWidgets.ts`
- `src/components/rightSidePanel/parameters/SectionWidgets.vue`
- `src/composables/graph/useErrorClearingHooks.ts`
There is also a minor contract inconsistency today: the source-scope clear currently receives the host widget's `{ min, max }` options. This is harmless for the promoted model combo/asset paths covered by #13059, but the helper should define whether source clears use source options, host options, or a normalized contract.
## Requested change
Extract the shared promoted-widget error-clearing orchestration into a reusable helper and update the three call sites to use it.
The helper should:
- encapsulate the "clear source scope, then clear host scope" sequence
- make the source-vs-host widget-name/option contract explicit
- preserve the current promoted missing-model behavior introduced in #13059
- avoid widening behavior unintentionally for unrelated widget flows
## Affected areas
- `src/renderer/extensions/vueNodes/composables/useProcessedWidgets.ts`
- `src/components/rightSidePanel/parameters/SectionWidgets.vue`
- `src/composables/graph/useErrorClearingHooks.ts`
Potentially related logic:
- `src/core/graph/subgraph/resolvePromotedWidgetSource.ts`
- `src/stores/executionErrorStore.ts`
## Acceptance criteria
- A shared helper is introduced for promoted-widget related error clearing.
- The helper is used by the node body, parameter panel, and graph hook surfaces listed above.
- The helper documents or encodes the intended source-vs-host `{ min, max }` option behavior.
- Existing promoted missing-model tests continue to pass, and any necessary unit coverage is added for the extracted helper behavior.
## Backlinks
- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/13059
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/13059#discussion_r3479446410
Requested by: @jaeone94
Contributor guide
Research direction
Read the three call sites in `useProcessedWidgets.ts`, `SectionWidgets.vue`, and `useErrorClearingHooks.ts`, along with the linked PR review comment, to understand the existing source-then-host sequence and its `{ min, max }` options. Run the existing promoted missing-model tests; done means all three surfaces use a shared helper, the option contract is explicit, and existing behavior still passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 53/100