fix: fix page undefined exception, close #770

This commit is contained in:
GyDi 2023-09-10 13:45:18 +08:00
parent ad228d53b7
commit 16d80718cb
No known key found for this signature in database
GPG Key ID: 9C3AD40F1F99880A

View File

@ -63,11 +63,12 @@ const ProfilePage = () => {
const type1 = ["local", "remote"];
const type2 = ["merge", "script"];
const regularItems = items.filter((i) => type1.includes(i.type!));
const restItems = items.filter((i) => type2.includes(i.type!));
const regularItems = items.filter((i) => i && type1.includes(i.type!));
const restItems = items.filter((i) => i && type2.includes(i.type!));
const restMap = Object.fromEntries(restItems.map((i) => [i.uid, i]));
const enhanceItems = chain
.map((i) => restMap[i]!)
.filter(Boolean)
.concat(restItems.filter((i) => !chain.includes(i.uid)));
return { regularItems, enhanceItems };