fix(cms): capture array container before node removal so reindex runs
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
The ❌ delete buttons called wrap.closest('.array-items') AFTER remove();
a detached node has no ancestors, so closest() returned null and
reindexItems() silently skipped. Remaining items kept their old indices,
collect() produced sparse arrays (null holes) and saves failed schema
validation, e.g. '$.details.services[1].specs.items[0]: string érték
szükséges'. Capture the container before remove() for both str-item and
obj-card delete handlers.
Regression test runs the real browser script in jsdom and clicks the
actual delete buttons (nested string array + object card reindexing).
Closes MITHOME-67
This commit is contained in:
@@ -116,7 +116,14 @@ function makeStrItem(val, idx, path) {
|
||||
del.className = 'btn-del';
|
||||
del.textContent = '❌';
|
||||
del.title = 'Törlés';
|
||||
del.onclick = () => { wrap.remove(); reindexItems(wrap.closest('.array-items')); };
|
||||
del.onclick = () => {
|
||||
// WHY: capture the container BEFORE removing — a detached node has no
|
||||
// ancestors, so closest() would return null and reindexing would silently
|
||||
// not run (sparse arrays → schema errors on save).
|
||||
const container = wrap.closest('.array-items');
|
||||
wrap.remove();
|
||||
reindexItems(container);
|
||||
};
|
||||
wrap.appendChild(ta);
|
||||
wrap.appendChild(del);
|
||||
return wrap;
|
||||
@@ -135,7 +142,12 @@ function makeObjCard(obj, idx, path) {
|
||||
const del = document.createElement('button');
|
||||
del.className = 'btn-del-card';
|
||||
del.textContent = '❌ Törlés';
|
||||
del.onclick = () => { card.remove(); reindexItems(card.closest('.array-items')); };
|
||||
del.onclick = () => {
|
||||
// Same as above: capture before detaching, or reindexing is skipped.
|
||||
const container = card.closest('.array-items');
|
||||
card.remove();
|
||||
reindexItems(container);
|
||||
};
|
||||
card.appendChild(del);
|
||||
return card;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user