fix: program exception when Awesome data is empty (#248)

This commit is contained in:
lencx
2023-01-25 16:49:20 +08:00
parent 7aa70c83de
commit ca171b7c1b
4 changed files with 38 additions and 21 deletions

View File

@@ -7,6 +7,10 @@
}
}
.markdown-body {
background-color: unset;
}
.about-tab {
.imgs {
img {

View File

@@ -29,15 +29,19 @@ export default function Dashboard() {
if (!json) return;
const categories = new Map();
json?.forEach((i) => {
if (!i.enable) return;
if (!categories.has(i.category)) {
categories.set(i.category, []);
}
categories.get(i?.category).push(i);
});
setList(Array.from(categories));
}, [json?.length]);
if (Array.isArray(json)) {
json?.forEach((i) => {
if (!i.enable) return;
if (!categories.has(i.category)) {
categories.set(i.category, []);
}
categories.get(i?.category).push(i);
});
setList(Array.from(categories) || []);
} else {
setList([]);
}
}, [JSON.stringify(json)]);
const handleLink = async (item: Record<string, any>) => {
await invoke('wa_window', {