mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 07:14:11 +00:00
## Summary Add infrastructure for automatic node replacement feature that allows missing/deprecated nodes to be replaced with their newer equivalents. ## Changes - **Types**: `NodeReplacement`, `NodeReplacementResponse` types matching backend API spec (PR #12014) - **Service**: `fetchNodeReplacements()` API wrapper - **Store**: `useNodeReplacementStore` with `getReplacementFor()`, `hasReplacement()`, `isEnabled()` - **Setting**: `Comfy.NodeReplacement.Enabled` toggle (experimental) - **Tests**: 11 unit tests covering store functionality ## Related - Backend PR: Comfy-Org/ComfyUI#12014 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8364-feat-Add-node-replacement-store-and-types-2f66d73d3650816bb771c9cc6a8e1774) by [Unito](https://www.unito.io) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Automatic node replacement is now available, allowing missing nodes to be replaced with their newer equivalents when replacement mappings exist. * Added "Enable automatic node replacement" experimental setting in Workflow preferences (enabled by default). * Replacement data is loaded during app initialization. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
14 lines
400 B
TypeScript
14 lines
400 B
TypeScript
import type { NodeReplacementResponse } from './types'
|
|
|
|
import { api } from '@/scripts/api'
|
|
|
|
export async function fetchNodeReplacements(): Promise<NodeReplacementResponse> {
|
|
const response = await api.fetchApi('/node_replacements')
|
|
if (!response.ok) {
|
|
throw new Error(
|
|
`Failed to fetch node replacements: ${response.status} ${response.statusText}`
|
|
)
|
|
}
|
|
return response.json()
|
|
}
|