fix(tags): selected tags not being highlighted in test result (@Leonabcd123) (#7312)

### Description

Update `data-active-tag-ids` instead of `active-tag-ids`, extract
updating part from if statement. Fixes the following bug:

- Create a tag
- Complete a test
- Click on the edit tags button
- Click on the newly created tag
- Click on the edit tags button again
- The tag won't be highlighted in yellow

Co-authored-by: Jack <jack@monkeytype.com>
This commit is contained in:
Leonabcd123 2026-01-05 18:54:06 +02:00 committed by GitHub
parent be4649c900
commit d09969f1ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1262,11 +1262,12 @@ export function updateTagsAfterEdit(
// $(`.pageTest #result .tags .bottom`).html(tagNames.join("<br>"));
$(`.pageTest #result .tags .bottom`).append(html);
$(`.pageTest #result .tags .top .editTagsButton`).attr(
"active-tag-ids",
tagIds.join(","),
);
}
$(`.pageTest #result .tags .top .editTagsButton`).attr(
"data-active-tag-ids",
tagIds.join(","),
);
}
$(".pageTest #result .chart .chartLegend button").on("click", (event) => {