From 82837254eadd218c402e3fe938f0478b70655c97 Mon Sep 17 00:00:00 2001 From: Robin Scholtes Date: Mon, 15 May 2023 12:52:13 +1200 Subject: [PATCH] fix selected class bug messed up after refactoring --- src/web/waiters/RecipeWaiter.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/web/waiters/RecipeWaiter.mjs b/src/web/waiters/RecipeWaiter.mjs index 696e37ce..50043ab2 100755 --- a/src/web/waiters/RecipeWaiter.mjs +++ b/src/web/waiters/RecipeWaiter.mjs @@ -611,7 +611,12 @@ class RecipeWaiter { * @param {string} opDataName the data-name of the target operation */ addSelectedClass(opDataName) { - document.querySelector(`.operation[data-name="${opDataName}"]`).classList.add("selected"); + const ops = document.querySelectorAll(`.operation[data-name="${opDataName}"]`); + + // A selected operation can occur twice if it's in favourites and the original category op-list + ops.forEach((op => { + op.classList.add("selected"); + })) } /**