mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 15:10:06 +00:00
Disable node def validation by default (#1190)
* Add setting * Make node def validation optional
This commit is contained in:
@@ -273,9 +273,15 @@ class ComfyApi extends EventTarget {
|
||||
* Loads node object definitions for the graph
|
||||
* @returns The node definitions
|
||||
*/
|
||||
async getNodeDefs(): Promise<Record<string, ComfyNodeDef>> {
|
||||
async getNodeDefs({ validate = false }: { validate?: boolean } = {}): Promise<
|
||||
Record<string, ComfyNodeDef>
|
||||
> {
|
||||
const resp = await this.fetchApi('/object_info', { cache: 'no-store' })
|
||||
const objectInfoUnsafe = await resp.json()
|
||||
if (!validate) {
|
||||
return objectInfoUnsafe
|
||||
}
|
||||
// Validate node definitions against zod schema. (slow)
|
||||
const objectInfo: Record<string, ComfyNodeDef> = {}
|
||||
for (const key in objectInfoUnsafe) {
|
||||
const validatedDef = validateComfyNodeDef(
|
||||
|
||||
@@ -1968,7 +1968,9 @@ export class ComfyApp {
|
||||
*/
|
||||
async registerNodes() {
|
||||
// Load node definitions from the backend
|
||||
const defs = await api.getNodeDefs()
|
||||
const defs = await api.getNodeDefs({
|
||||
validate: useSettingStore().get('Comfy.Validation.NodeDefs')
|
||||
})
|
||||
await this.registerNodesFromDefs(defs)
|
||||
await this.#invokeExtensionsAsync('registerCustomNodes')
|
||||
if (this.vueAppReady) {
|
||||
@@ -2911,7 +2913,9 @@ export class ComfyApp {
|
||||
useModelStore().clearCache()
|
||||
}
|
||||
|
||||
const defs = await api.getNodeDefs()
|
||||
const defs = await api.getNodeDefs({
|
||||
validate: useSettingStore().get('Comfy.Validation.NodeDefs')
|
||||
})
|
||||
|
||||
for (const nodeId in defs) {
|
||||
this.registerNodeDef(nodeId, defs[nodeId])
|
||||
|
||||
Reference in New Issue
Block a user