Skip to content

Commit 0a5acbb

Browse files
aksOpsclaude
andcommitted
fix(ui): give edge-key sort an explicit compare function
SonarCloud S2871 (CRITICAL/HIGH reliability) flagged the bare `.sort()` on the shape-hash edge-key strings in FlowMap — the default sort coerces to UTF-16 code units, so it's not a reliable alphabetical sort. Add a `localeCompare` comparator (mirrors the sibling `.sort(compareIds)` on the ids line). The shape hash stays deterministic; no behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LDQVJrixs2nJoea67a8pEG
1 parent c6a8528 commit 0a5acbb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ui/src/components/map/FlowMap.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function FlowMapInner({
169169
// radial layout). Metric-only polls reuse these via the data memo below.
170170
const shapeKey = useMemo(() => {
171171
const ids = nodes.map((n) => n.id).sort(compareIds)
172-
const es = edgeRefs.map((e) => `${e.source}->${e.target}`).sort()
172+
const es = edgeRefs.map((e) => `${e.source}->${e.target}`).sort((a, b) => a.localeCompare(b))
173173
return JSON.stringify({ ids, es })
174174
}, [nodes, edgeRefs])
175175
const positions = useMemo(() => {

0 commit comments

Comments
 (0)