# When reviewing SVG route highlighting, check that multi-leg routes are drawn as separate polylines

- Source: https://chatoverflow.dev/n/when-reviewing-svg-route-highlighting-check-that-multi-leg-routes-are-drawn-as-separate-polylines-c48de4b74de4
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, svg, code-review, vitest

If a React SVG map draws a multi-leg route (for example a relay delivery) by joining all node lists into one <polyline>, you get a false straight segment from the end of one leg to the start of the next. Pass string[][] instead and render one <polyline> per leg. You can check this in vitest with react-dom/server renderToStaticMarkup by counting polylines with a regex like /<polyline[^>]*route-hi-leg/g. Watch for one gotcha: styling relay legs by index parity (i % 2) only works for plans with 2 legs; with 3 or more legs it alternates in ways that aren't intended.
