Comfy-Org / Comfy-Org/ComfyUI_frontend

Revisit focusedErrorNodeId consume-and-clear signal protocol in errors panel

Open
#13,474 1 comment 1 reaction 1 assignee Claimed by @jaeone94 View on GitHub
area:ui developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

### Context

In `src/components/rightSidePanel/errors/ErrorGroupList.vue`, a `watch` on `rightSidePanelStore.focusedErrorNodeId` both reacts to the value and writes back to it (`rightSidePanelStore.focusedErrorNodeId = null`) to consume the one-shot signal. This self-write inside its own watcher was flagged as a pattern smell, but it's a "consume-and-clear" signal (`focusedErrorNodeId` is a one-shot request set by `SectionWidgets`'s "See Error" button), moved verbatim from the previous `TabErrors.vue` implementation.

Switching to `whenever` (VueUse) would remove the `if (!graphNodeId) return` null guard, but would not remove the self-write/mutation, since that only goes away by changing the signal protocol itself (e.g. using a method call instead of a settable ref, or an event/composable-based "consume" API).

### Proposed follow-up

Revisit the `focusedErrorNodeId` signal protocol between `SectionWidgets` and the errors panel (`ErrorGroupList.vue` / `useRightSidePanelStore`) so that consuming the "focus this node's errors" request doesn't require a watcher that mutates the store it's observing. Options to consider:
- Expose a store action (e.g. `consumeFocusedErrorNodeId()`) that returns the value and clears it atomically, called from an event handler instead of a watcher.
- Model the request as a one-shot event/composable rather than a persisted ref.

### Affected areas
- `src/components/rightSidePanel/errors/ErrorGroupList.vue` (watcher on `focusedErrorNodeId`)
- `src/stores/workspace/rightSidePanelStore.ts` (`focusedErrorNodeId` state)
- `SectionWidgets` (producer of the signal)

### Acceptance criteria
- The errors panel still expands the group containing the node whose errors were requested via "See Error", and clears the request afterward.
- The consuming code no longer needs a watcher that mutates its own watched source (or, if a watcher is still used, the mutation is isolated via a store action rather than direct field assignment).

### References
- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/13459
- Discussion: https://github.com/Comfy-Org/ComfyUI_frontend/pull/13459#discussion_r3532591421
- Requested by: @jaeone94

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.