Skip to content

Commit 1a6ba7d

Browse files
committed
Flatten the bom table only once for efficiency
1 parent cb0a053 commit 1a6ba7d

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

InteractiveHtmlBom/web/ibom.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,6 @@ function highlightFilter(s) {
362362
return r;
363363
}
364364

365-
function findBomRefRowById(id) {
366-
var allList = getBomListByLayer('FB').flat();
367-
return allList.find(item => item[1] == Number(id)) || [];
368-
}
369-
370365
function getBomListByLayer(layer) {
371366
switch (layer) {
372367
case 'F': return pcbdata.bom.F.slice();
@@ -653,7 +648,7 @@ function populateBomBody(placeholderColumn = null, placeHolderElements = null) {
653648
var first = true;
654649
var style = getComputedStyle(topmostdiv);
655650
var defaultNetColor = style.getPropertyValue('--track-color').trim();
656-
651+
657652
bomtable = getSelectedBomList();
658653

659654
if (bomSortFunction) {

InteractiveHtmlBom/web/util.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,9 @@ function initUtils() {
206206
if (config.fields.includes("Value")) {
207207
var index = config.fields.indexOf("Value");
208208
pcbdata.bom["parsedValues"] = {};
209+
var allList = getBomListByLayer('FB').flat();
209210
for (var id in pcbdata.bom.fields) {
210-
var ref_key = findBomRefRowById(id)[0] ||'';
211+
var ref_key = allList.find(item => item[1] == Number(id)) || [];
211212
pcbdata.bom.parsedValues[id] = parseValue(pcbdata.bom.fields[id][index], ref_key);
212213
}
213214
}

0 commit comments

Comments
 (0)