INNER CODE UNIT · JavaScript
nodesToBeCreated
AscensionGameDev/Intersect-Engine · Intersect.Server/wwwroot/js/assets.js:667
const nodesToBeCreated = nodes.filter(n => nodeMap.has(n.id));
for (const node of nodesToBeCreated) {
const { id, parentId, Path, Type } = node;
const nodeIndex = nodes.indexOf(node);
const previousNodeIndex = nodeIndex - 1;
const previousNode = nodes[previousNodeIndex] ?? null;
const previousElement = previousNode === null ? null : (this.#rows.find(r => r.getAttribute('data-id') === previousNode.id) ?? null);
const nextElement = previousElement?.nextElementSibling;
const row = this.#rowTemplate.content.cloneNode(true).querySelector('tr');
row.setAttribute('data-id', id);
row.setAttribute('data-parent-id', parentId);
row.setAttribute('data-type', Type);
updateRow(row, node);
this.#tableBody.insertBefore(row, nextElement);
this.#rows.push(row);