Comfy-Org / Comfy-Org/ComfyUI_frontend
Circular deps: subscription-dialog mutual dependency cluster
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Problem
`dpdm` detected mutual circular dependencies between `dialogService` and multiple subscription composables:
```
dialogService.ts → useSubscription.ts → (back to dialogService via useDialogService)
dialogService.ts → useSubscriptionDialog.ts → (back to dialogService)
useSubscription.ts → useFirebaseAuthActions.ts → (back to useSubscription)
useSubscription.ts → useSubscriptionCancellationWatcher.ts → (back to useSubscription)
```
### Root cause
`dialogService.ts` imports `useSubscription` to show subscription-related dialogs, while `useSubscription.ts` imports `useDialogService` to trigger dialogs. Three subscription composables all depend on `dialogService` and vice versa.
### Impact
- Circular import chains make the subscription + dialog modules tightly coupled
- Difficult to test either module in isolation
- Risk of undefined imports at module evaluation time
### Suggested fix
- Use an event bus or callback pattern: `useSubscription` emits events that `dialogService` listens to, breaking the direct import cycle
- Alternatively, extract the subscription dialog configuration to a registry that `dialogService` consumes without importing subscription composables
### Files involved
- `src/services/dialogService.ts`
- `src/platform/cloud/subscription/composables/useSubscription.ts`
- `src/platform/cloud/subscription/composables/useSubscriptionDialog.ts`
- `src/platform/cloud/subscription/composables/useSubscriptionCancellationWatcher.ts`
- `src/composables/auth/useFirebaseAuthActions.ts`
Parent: #11022
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11097-Circular-deps-subscription-dialog-mutual-dependency-cluster-33e6d73d365081d2ac85e7db6a8b1ff7) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.