Fix handleFile monkeypatch for new frontend signature

handleFile signature is updated in ComfyUI frontend [handleFile (file: File, openSource?: WorkflowOpenSource, options?: { deferWarnings?: boolean } )]. Using rest parameters to fix and future-proof.
This commit is contained in:
PxTicks 2026-02-23 22:16:19 +00:00 committed by GitHub
parent c88a9985c1
commit 3ca18bf204
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -678,7 +678,7 @@ export class ComponentBuilderDialog extends ComfyDialog {
let orig_handleFile = app.handleFile;
async function handleFile(file) {
async function handleFile(file, ...args) {
if (file.name?.endsWith(".json") || file.name?.endsWith(".pack")) {
const reader = new FileReader();
reader.onload = async () => {
@ -694,7 +694,7 @@ async function handleFile(file) {
await handle_import_components(jsonContent);
}
else {
orig_handleFile.call(app, file);
orig_handleFile.call(app, file, ...args);
}
};
reader.readAsText(file);
@ -702,7 +702,7 @@ async function handleFile(file) {
return;
}
orig_handleFile.call(app, file);
orig_handleFile.call(app, file, ...args);
}
app.handleFile = handleFile;