1
0
Fork 0

fix(gui): handle partial extras file without totally crashing

This commit is contained in:
Sean Sube 2023-05-15 22:09:53 -05:00
parent 5ede55499a
commit 52b7521d77
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@ const { useContext, useEffect } = React;
// eslint-disable-next-line @typescript-eslint/unbound-method // eslint-disable-next-line @typescript-eslint/unbound-method
const { kebabCase } = _; const { kebabCase } = _;
function mergeModelLists<T extends DiffusionModel | ExtraSource>(local: Array<T>, server: Array<T>) { function mergeModelLists<T extends DiffusionModel | ExtraSource>(local: Array<T>, server: Array<T> = []) {
const localNames = new Set(local.map((it) => it.name)); const localNames = new Set(local.map((it) => it.name));
const merged = [...local]; const merged = [...local];
@ -43,7 +43,7 @@ function mergeModelLists<T extends DiffusionModel | ExtraSource>(local: Array<T>
return merged; return merged;
} }
function mergeModels(local: ExtrasFile, server: ExtrasFile): ExtrasFile { function mergeModels(local: ExtrasFile, server: Partial<ExtrasFile>): ExtrasFile {
const merged: ExtrasFile = { const merged: ExtrasFile = {
...server, ...server,
correction: mergeModelLists(local.correction, server.correction), correction: mergeModelLists(local.correction, server.correction),