From 3e32fdb83f1b10ae9ad3e9f455ec3263e3afa107 Mon Sep 17 00:00:00 2001 From: G1org1owo <77230371+G1org1owo@users.noreply.github.com> Date: Sun, 27 Apr 2025 23:03:10 +0200 Subject: [PATCH] Fix undefined tag usages access in PopupMain.vue --- src/popup/pages/PopupMain.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/popup/pages/PopupMain.vue b/src/popup/pages/PopupMain.vue index a5d5d75..813b7a8 100644 --- a/src/popup/pages/PopupMain.vue +++ b/src/popup/pages/PopupMain.vue @@ -314,9 +314,8 @@ async function loadTagCounts() { if (resp) { for (let post of pop.posts) for (let tag of resp.results) { - // @ts-expect-error .find() can't return undefined because the resp.results list can only contain - // the tags which we requested. And we only request the tags which are already set on the post. - post.tags.find((postTag) => tag.names.includes(postTag.name)).usages = tag.usages; + const postTag = post.tags.find((postTag) => tag.names.includes(postTag.name)); + if(postTag) postTag.usages = tag.usages; } } }