Comfy-Org / Comfy-Org/ComfyUI_frontend
refactor: relocate appUtil utilities to domain-appropriate modules
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
During PR #11400 (test coverage extension for `ComfyApp`), four pure functions were extracted into `src/scripts/appUtil.ts` as part of a refactor commit. However, `appUtil` is a generic catch-all and does not reflect domain-driven design. These functions should be relocated to more appropriate modules.
## Functions to Relocate
| Function | Current Location | Suggested Domain |
|---|---|---|
| `sanitizeNodeName` | `src/scripts/appUtil.ts` | `src/platform` or `src/utils` (string/sanitization util) |
| `isApiJson` | `src/scripts/appUtil.ts` | `src/platform/workflow/validation` (workflow validation) |
| `stackNodesVertically` | `src/scripts/appUtil.ts` | `src/utils` or `src/workspace` (graph/layout util) |
| `positionBatchLayout` | `src/scripts/appUtil.ts` | `src/utils` or `src/workspace` (graph/layout util) |
## Context
- Raised in: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11400#discussion_r3114738396
- Kept as-is in PR #11400 since that PR is focused on test coverage; relocation is a separate concern.
- Re-exports in `src/scripts/app.ts` and test files (`src/scripts/appUtil.test.ts`) will need to be updated once the functions are moved.
## Acceptance Criteria
- [ ] Each function lives in a module that reflects its domain responsibility
- [ ] `src/scripts/appUtil.ts` is either removed or contains only functions with no better home
- [ ] All existing tests continue to pass after relocation
- [ ] Re-exports and import paths are updated across the codebase
Requested by @christian-byrne.
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11532-refactor-relocate-appUtil-utilities-to-domain-appropriate-modules-34a6d73d36508144bc65db0db7dafee6) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.