Skip to content

Untangle circular dependencies for an acyclic module graph (Stack 4/4) - #394

Closed
ccombe wants to merge 5 commits into
jameskerr:mainfrom
ccombe:untangle-circular-deps
Closed

ccombe wants to merge 5 commits into
jameskerr:mainfrom
ccombe:untangle-circular-deps

Conversation

@ccombe

@ccombe ccombe commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Part 4 of the @dnd-kit migration stack (#390).
Note: This PR is in draft mode and branches from #393 (guard-clauses-and-cleanup). Once preceding PRs are merged, this branch will be rebased onto main.

Summary

Untangles 21 circular dependency loops across the library, achieving a completely acyclic module graph (0 circular dependencies confirmed via madge on built output).

Changes

  • interfaces/tree-api.ts: Remove UI component imports (DefaultContainer, DefaultRow, DefaultNode, DefaultDragPreview, DefaultCursor), eliminating circular imports with component renderers and context.ts.
  • components/row-container.tsx, components/cursor.tsx, components/default-drag-preview.tsx: Resolve default fallbacks locally rather than depending on TreeApi circular imports.
  • interfaces/node-api.ts & data/create-root.ts: Relocate ROOT_ID to break the bidirectional cycle between node-api and create-root.
  • state/drag-slice.ts, state/dnd-slice.ts, state/selection-slice.ts, state/initial.ts: Define slice-local initial state constants to decouple slices from initial.ts and root-reducer.ts.
  • Type files (types/renderers.ts, types/tree-props.ts, types/handlers.ts, types/utils.ts): Use import type to ensure zero runtime dependency emissions.

Verification

  • Dependency validation: madge --circular modules/react-arborist/dist/module/index.js reports 0 circular dependencies.
  • Unit tests: All 142 tests pass warning-free (yarn workspace react-arborist test).
  • E2E tests: All 4 Cypress specs pass (yarn workspace e2e test).
  • Lint and formatting: Oxlint and Oxfmt pass cleanly with 0 warnings.

@netlify

netlify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for react-arborist ready!

Name Link
🔨 Latest commit 40ddf4c
🔍 Latest deploy log https://app.netlify.com/projects/react-arborist/deploys/6ad8858231c937e6c0682e2b
😎 Deploy Preview https://deploy-preview-394--react-arborist.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ccombe

ccombe commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Moved out of the migration stack: this work does not depend on @dnd-kit, so it is now tracked as #398. The branch untangle-circular-deps is kept for when the migration lands.

@ccombe ccombe closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant