Comfy-Org / Comfy-Org/ComfyUI_frontend

[RFC] Migrate flat stores to domain directories

Open
#11,017 0 comments 0 reactions 0 assignees View on GitHub
developer experience refactor
Dominant language
TypeScript
Stars
2k
Forks
702
Avg merge
1d 8h
Merged PRs (30d)
512

Description

## Problem

41 store files live in `src/stores/` as a flat directory, while only 16 are domain-organized under `src/platform/`. Many stores belong to clear domains but sit together: `subgraphStore`, `subgraphNavigationStore`, `executionStore`, `executionErrorStore`, `jobPreviewStore`, `nodeDefStore`, `nodeBookmarkStore`, `nodeOutputStore`, `modelStore`, `modelToNodeStore`, etc.

When working on "execution," you bounce between `executionStore.ts`, `executionErrorStore.ts`, `jobPreviewStore.ts`, `queueStore.ts`, `resultItemParsing.ts` — all in the same flat folder with 35+ unrelated stores.

## Proposed Deepening

Migrate domain-cohesive store clusters into platform domains:

| Store cluster | Target |
|--------------|--------|
| `subgraphStore` + `subgraphNavigationStore` | `src/platform/subgraph/` |
| `executionStore` + `executionErrorStore` + `jobPreviewStore` | `src/platform/execution/` |
| `nodeDefStore` + `nodeBookmarkStore` + `nodeOutputStore` | `src/platform/nodeDefs/` |
| `modelStore` + `modelToNodeStore` | `src/platform/assets/` (where `missingModel/` already lives) |
| `queueStore` + `resultItemParsing` | `src/platform/queue/` |

Stores that are genuinely cross-cutting (e.g., `commandStore`, `workspaceStore`, `dialogStore`) remain in `src/stores/`.

## Migration Plan

1. Move one cluster per PR
2. Update all import paths (IDE refactor + verify with `pnpm typecheck`)
3. No behavioral changes — purely organizational

## Testing Strategy

- `pnpm typecheck` and `pnpm lint` pass after each move
- All existing tests pass unchanged (only import paths change)

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11017-RFC-Migrate-flat-stores-to-domain-directories-33e6d73d3650815da62ac15cbc9ae7e5) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Research direction

Start by choosing one listed cluster, such as executionStore.ts, executionErrorStore.ts, and jobPreviewStore.ts, and inspect their imports and current locations under src/stores/. Move only that cluster, update the import paths, then run pnpm typecheck, pnpm lint, and the existing tests. Done means the cluster is under its target src/platform directory with no behavioral changes and all checks passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.