mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-24 22:58:08 +00:00
## Summary https://linear.app/comfyorg/issue/FE-727/refactor-usemediaasset `useMediaAssets` was a factory wrapper that branched on `isCloud` and returned one of two near-identical implementations (`useAssetsApi` / `useInternalFilesApi`). Both implementations delegated to the same `assetsStore` actions (`updateInputs` / `updateHistory` / `loadMoreHistory`) — the real cloud/local fork lives inside `assetsStore.fetchInputFiles` (line 121), not at the composable layer. Collapse the wrapper: 1. Delete `useInternalFilesApi` (identical to `useAssetsApi`). 2. Delete `useMediaAssets` (now a pass-through). 3. Switch the four callers to `useAssetsApi` directly. ## Changes - **What**: - Delete `useInternalFilesApi.ts` and `useMediaAssets.ts`. - `AssetsSidebarTab.vue`, `WidgetSelectDropdown.vue`, `useOutputHistory.ts`: call `useAssetsApi` directly. - `useWidgetSelectItems.ts`: narrow `outputMediaAssets` prop type to `IAssetsProvider` (the interface `useOutputHistory` already implements directly). - Test mocks repointed from `useMediaAssets` → `useAssetsApi`. - Two unrelated tailwind class-order lint errors auto-fixed by `pnpm lint:fix` to keep CI green. - **Breaking**: None — no behavior change. ## Review Focus The real cloud/local fork remains at `assetsStore.ts:121` (`fetchInputFiles = isCloud ? fetchInputFilesFromCloud : fetchInputFilesFromAPI`). That branch is M1-strict and clears once BE-933 lands. This PR only collapses the dead wrapper layer above it. `IAssetsProvider` is intentionally kept — `useOutputHistory.ts:83` directly implements it for a different use case, so the interface still has more than one consumer. Surfaced while working on the FE-678 cloud/local asset branching survey. ## Screenshots (if applicable) N/A — no UI change. --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>