Fix refresh wiping all links when JSON file is missing
Some checks failed
Publish to Comfy registry / Publish Custom Node to registry (push) Has been cancelled

When the file at json_path didn't exist, clicking Refresh Outputs
returned empty keys causing all outputs and links to be removed.
Now the API returns an error flag and the frontend bails out early,
preserving existing outputs.

Bump version to 1.2.1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 14:19:05 +01:00
parent 58c53e6229
commit f05735dcc0
3 changed files with 11 additions and 2 deletions

View File

@@ -63,6 +63,8 @@ if PromptServer is not None:
seq = 1
data = read_json_data(json_path)
target = get_batch_item(data, seq)
if not data:
return web.json_response({"keys": [], "types": [], "error": "file_not_found"})
keys = []
types = []
if isinstance(target, dict):

View File

@@ -1,6 +1,6 @@
[project]
name = "comfyui-json-dynamic"
version = "1.2.0"
version = "1.2.1"
description = "ComfyUI nodes for dynamic JSON loading and string/path utility operations"
license = { file = "LICENSE" }
requires-python = ">=3.10"

View File

@@ -39,7 +39,14 @@ app.registerExtension({
const resp = await api.fetchApi(
`/json_dynamic/get_keys?path=${encodeURIComponent(pathWidget.value)}&sequence_number=${seqWidget?.value || 1}`
);
const { keys, types } = await resp.json();
const data = await resp.json();
const { keys, types } = data;
// If the file wasn't found, keep existing outputs and links intact
if (data.error === "file_not_found") {
console.warn("[JSONDynamicLoader] File not found, keeping existing outputs:", pathWidget.value);
return;
}
// Store keys and types in hidden widgets for persistence
const okWidget = this.widgets?.find(w => w.name === "output_keys");