fix(gui): handle partial extras file without totally crashing
This commit is contained in:
parent
5ede55499a
commit
52b7521d77
|
@ -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),
|
||||||
|
|
Loading…
Reference in New Issue