mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 15:35:22 +02:00
Ensure saved items that are marked for removal don't impact the index
This commit is contained in:
parent
555ab8fb97
commit
df096c9b5f
1 changed files with 11 additions and 7 deletions
|
@ -72,6 +72,9 @@ export default class extends Controller {
|
||||||
const items = Array.from(listEl.children);
|
const items = Array.from(listEl.children);
|
||||||
let conditionIdx = 0;
|
let conditionIdx = 0;
|
||||||
items.forEach((item) => {
|
items.forEach((item) => {
|
||||||
|
// Only process visible items, this prevents conditions that are marked for removal and hidden
|
||||||
|
// from being added to the index. This is important when editing a rule.
|
||||||
|
if (!item.classList.contains('hidden')) {
|
||||||
const prefixEl = item.querySelector('[data-condition-prefix]');
|
const prefixEl = item.querySelector('[data-condition-prefix]');
|
||||||
if (prefixEl) {
|
if (prefixEl) {
|
||||||
if (conditionIdx === 0) {
|
if (conditionIdx === 0) {
|
||||||
|
@ -81,6 +84,7 @@ export default class extends Controller {
|
||||||
}
|
}
|
||||||
conditionIdx++;
|
conditionIdx++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue