Skip to content

Commit

Permalink
fix: don't return in cycle on error
Browse files Browse the repository at this point in the history
  • Loading branch information
Azgaar committed Aug 15, 2024
1 parent 0910aed commit a051698
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions modules/dynamic/auto-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,13 +869,17 @@ export function resolveVersionConflicts(version) {
pack.routes = [];
const POINT_DISTANCE = grid.spacing * 0.75;

routes.selectAll("g").each(function () {
const group = this.id;
if (!group) return;
for (const g of document.querySelectorAll("#viewbox > #routes > g")) {
const group = g.id;
if (!group) continue;

for (const node of this.querySelectorAll("path")) {
for (const node of g.querySelectorAll("path")) {
const totalLength = node.getTotalLength();
if (!totalLength) debugger;
if (!totalLength) {
ERROR && console.error("Route path has zero length", node);
continue;
}

const increment = totalLength / Math.ceil(totalLength / POINT_DISTANCE);
const points = [];

Expand All @@ -887,15 +891,17 @@ export function resolveVersionConflicts(version) {
points.push([x, y, cellId]);
}

if (points.length < 2) return;
if (points.length < 2) {
ERROR && console.error("Route path has less than 2 points", node);
continue;
}

const secondCellId = points[1][2];
const feature = pack.cells.f[secondCellId];

pack.routes.push({i: pack.routes.length, group, feature, points});
}
});

}
routes.selectAll("path").remove();
if (layerIsOn("toggleRoutes")) drawRoutes();

Expand Down

0 comments on commit a051698

Please sign in to comment.