Comfy-Org / Comfy-Org/ComfyUI_frontend
Refactor error groups to be self-describing instead of branching on group.type in ErrorGroupList.vue
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
`ErrorGroupList.vue` renders group-specific cards (`MissingNodeCard`, `SwapNodesCard`, `MissingModelCard`, `MissingMediaCard`, execution error list) by branching on `group.type` in the template and then pulling the actual data each card needs from unrelated sibling variables/composables (e.g. `missingPackGroups`, `swapNodeGroups`, `missingModelGroups`, `missingMediaGroups` from `useErrorGroups`), rather than from the `group` object itself.
This makes the template harder to follow since understanding what a given group renders requires cross-referencing multiple state sources instead of just the group's own data.
## Proposed change
Make each error group self-describing by having it carry references to the data its corresponding card needs, so the template can render based on the group's own shape instead of branching on `group.type` and reaching into sibling variables.
## Affected areas
- `src/components/rightSidePanel/errors/ErrorGroupList.vue` (template branching logic)
- `src/components/rightSidePanel/errors/useErrorGroups.ts` (group-building/composable layer that would need to attach the relevant data to each group)
## Acceptance criteria
- Each error group object includes the data required to render its corresponding card, without the template needing to read from unrelated sibling variables.
- `ErrorGroupList.vue` template no longer needs `v-if="group.type === '...'"` branches paired with separate lookups into `missingPackGroups`, `swapNodeGroups`, `missingModelGroups`, `missingMediaGroups`, etc.
- No behavior change to the rendered UI; this is a structural refactor.
- Existing unit/E2E tests for the errors panel continue to pass.
## Context
Raised during review of #13459:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/13459#discussion_r3532516985
Requested by @jaeone94 as a dedicated follow-up refactor, since it touches the group-building layer in `useErrorGroups.ts` and was considered out of scope for that PR.
Contributor guide
Assessment
This issue has not been assessed yet.