refactor(ui): prune orphaned hand-rolled service-map helpers#112
Merged
Conversation
The React Flow migration (#111) left the old hand-rolled map's layout, pan/zoom and keyboard-walk helpers in lib/ as dead code — 0 production references, kept compiling only by their own unit tests and tree-shaken out of the shipped bundle. Remove them: dagLayout.ts layoutGraph (+ sanitize/cycle/layer/order helpers), graphSetHash, fitTransform, zoomAt, walkFrom, edgePath, the Transform/WalkDir types, GAP_Y/MIN_ZOOM/MAX_ZOOM. radialLayout.ts walkRadial (+ center/angleOf/nearestOnRing). Kept the shared primitives still consumed by FlowMap + layoutRadial: GraphEdgeRef/LayoutNode/Layout, NODE_W/NODE_H/GAP_X, compareIds, edgeWidth, neighborsOf, and layoutRadial itself. Both test files trimmed to the kept exports. No behaviour change and no bundle-size change (the code was already tree-shaken): tsc clean, 339 tests pass, jscpd 0.43%. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LDQVJrixs2nJoea67a8pEG
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Follow-up to #111 (React Flow service-map migration). That PR moved layout interaction (pan/zoom/fit/keyboard-walk/edge drawing) to React Flow but left the old hand-rolled implementations behind in
ui/src/lib/as dead code: 0 production references, kept compiling only by their own unit tests and tree-shaken out of the shipped bundle.Removed
dagLayout.ts—layoutGraph(+ its privatesanitizeEdges/dfsKeepForwardEdges/breakCycles/assignLayers/orderLayers),graphSetHash,fitTransform,zoomAt,walkFrom,edgePath; theTransform/WalkDirtypes; theGAP_Y/MIN_ZOOM/MAX_ZOOMconstants.radialLayout.ts—walkRadial(+ privatecenter/angleOf/nearestOnRing).__tests__files trimmed to the kept exports.Kept (still consumed by
FlowMap+layoutRadial)GraphEdgeRef/LayoutNode/Layouttypes,NODE_W/NODE_H/GAP_X,compareIds,edgeWidth,neighborsOf, andlayoutRadialitself.Why it's safe
Pure dead-code removal — no behaviour change. The deleted code had no path from the entry chunk, so it never shipped: the production bundle is byte-for-byte the same size before and after (186 KB gz).
Verification
tsc -bcleanjscpd0.43% (gate 3%)npm run buildgreen, bundle size unchanged🤖 Generated with Claude Code