From cae923b68aad6943ade88309a16bd2a60c71df6e Mon Sep 17 00:00:00 2001 From: G1org1owo <77230371+G1org1owo@users.noreply.github.com> Date: Tue, 9 Jul 2024 01:31:35 +0200 Subject: [PATCH] Refactor nesting in loadTagCounts() --- src/popup/pages/PopupMain.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/popup/pages/PopupMain.vue b/src/popup/pages/PopupMain.vue index 40d2a63..5c198b8 100644 --- a/src/popup/pages/PopupMain.vue +++ b/src/popup/pages/PopupMain.vue @@ -313,12 +313,11 @@ async function loadTagCounts() { // Not the best code, but it works I guess? if (resp) { for (let post of pop.posts) - for (let tag of resp.results) - for (let postTag of post.tags) - if (tag.names.includes(postTag.name)) { - postTag.usages = tag.usages; - break; - } + for (let tag of resp.results) { + post.tags + .find(postTag => tag.names.includes(postTag.name)) + .usages = tag.usages; + } } } }