refactor(web): Phase C — consolidate to one Force Graph plugin#367
Merged
Conversation
The unified r3f engine now serves both 2D and 3D projections (ADR-702), so the d3 `react-force-graph-2d` plugin has no remaining role. Removed: - `web/src/explorers/ForceGraph2D/` — entire plugin - `react-force-graph-2d` dependency - `web/src/utils/graphTransform.ts` — only consumed by the d3 plugin and one unused `usePrefetchSubgraph` hook - `web/src/explorers/common/GraphSettingsPanel.tsx` — last consumer was the d3 plugin's ProfilePanel - `usePrefetchSubgraph` in `useGraphData.ts` — never called Cleaned the `force-2d` special-case out of `ExplorerView` (the legacy GraphSettingsPanel branch), the sidebar entry in `AppLayout`, the `/explore/2d` route in `App.tsx`, and the `'force-2d'` member of the `VisualizationType` union. The Zustand default falls back to `'force-3d'` until plugin consolidation lands. `/explore/2d-v2` and `/explore/3d` remain as the unified-engine routes during the consolidation step that follows.
…on toggle Three plugin entries (force-2d-v2, force-3d, plus the now-retired d3 force-2d) collapse into one `force-graph` plugin backed by the unified r3f + GPU engine (ADR-702). Projection is a user-facing setting inside the plugin — the engine dispatches camera, drag plane, and sim axis count from `settings.projection`. User-visible changes: - Sidebar shows a single "Force Graph" entry (was two) - Canonical route is `/explore/graph` - Legacy `/explore/2d` and `/explore/3d` redirect to `/explore/graph` via a small `RedirectPreservingSearch` helper, so bookmarked concept ids and depth params carry over - `/explore/2d-v2` removed without a redirect — it was an in-flight dev-only route from PR #366 Code changes: - VisualizationType: drop `force-2d-v2`, `force-3d`; add `force-graph` - `ForceGraph3D/index.ts`: drop the `createForceGraphPlugin` factory; export a single `ForceGraphExplorer` - Reports record the active projection from settings (not from the explorer type, which is no longer 2D/3D-discriminated) - Home screen NavigationGraph replaces the two 2D/3D nodes with one Force Graph node - AppLayout drops the now-unused Boxes and Map icons; uses Network for the consolidated explorer - Zustand `selectedExplorer` defaults to `'force-graph'`
After consolidation (previous commit), the engine handles both
projections — the `3D` suffix on the directory, file, component, and
type names became misleading. Renamed:
- `web/src/explorers/ForceGraph3D/` → `web/src/explorers/ForceGraph/`
- `ForceGraph3D.tsx` → `ForceGraph.tsx`
- Component `ForceGraph3D` → `ForceGraph`
- Type `ForceGraph3DData` → `ForceGraphData`
- Type `ForceGraph3DSettings` → `ForceGraphSettings`
- On-canvas debug label "ForceGraph3D" → "Force Graph"
git tracks all moves as renames (no content drift), so blame history
follows.
Comment scrub for transitional V1/V2/d3-coexistence framing in
`common/useGraphContextMenu.ts`, `common/nodeColors.ts`,
`ForceGraph/scene/EdgeLabels.tsx`, and `ForceGraph/scene/Scene.tsx` —
those readers no longer have a V1 to compare against.
Ways updated to match: `web/explorers/explorers.md` references the new
path and rewords the interaction-model section now that d3
ForceGraph2D is gone; `web/evolution/evolution.md` adds a Phase C
reference.
Per `.claude/ways/kg/web/evolution/evolution.md` ("Drop Transitional
Framing Post-Promotion").
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.
Summary
Phase C of the unified-engine work (ADR-702). Three force-graph plugin entries collapse to one. Projection is now a user-facing setting on the single plugin, not a separate explorer type. The d3 `react-force-graph-2d` dependency goes away.
End state:
Commits
Manual verification (recommended before merge)
The vitest suite and `tsc --noEmit` are clean, but neither exercises the runtime paths this PR touches. Worth checking in the browser:
`kg-web-dev` HMR may need a one-time `docker restart kg-web-dev` after pulling — a whole-dir rename plus symbol renames can leave the Vite module graph stale.
Notes
References