Skip to content

refactor(admin): remove circular deps and recover lazy HMR loads#83

Merged
DavidBabinec merged 1 commit into
mainfrom
refactor/no-circular-deps-hmr
Jun 26, 2026
Merged

refactor(admin): remove circular deps and recover lazy HMR loads#83
DavidBabinec merged 1 commit into
mainfrom
refactor/no-circular-deps-hmr

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

Summary

  • Reduced the tsconfig-aware source graph from 31 circular dependencies to 0 by extracting pure leaf schema/type/helper barrels and moving cycle-sensitive internals off broad barrels.
  • Added retryable lazy/HMR loading for the Site editor body: failed prewarmed imports clear their failed state, expose reset(), and render a retryable chunk boundary instead of leaving the admin on an endless skeleton.
  • Added architecture coverage for zero circular dependencies and tightened the Fast Refresh/lazy-body gates.

Impact

The broad app-facing barrels remain available, while cycle-sensitive internals now depend on pure leaves such as @core/page-tree-schema, @core/module-engine-schema, @core/site-runtime-schema, @core/visual-components-schema, and @core/html-sanitize. Base module editor components no longer import their registration barrels, which keeps Fast Refresh boundaries component-only.

Verification

  • bun x madge --circular --ts-config tsconfig.json --extensions ts,tsx src server — processed 2282 files, 3 warnings, 0 circular dependencies.
  • bun test src/__tests__/architecture/no-circular-dependencies.test.ts — 1 pass, 0 fail.
  • bun test src/__tests__/architecture/canvasFastRefreshBoundaries.test.ts src/__tests__/architecture/site-editor-shell-lazy-body.test.ts — 8 pass, 0 fail.
  • bun run build — passed.
  • bun test — 5486 pass, 0 fail.
  • bun run lint — passed.

Manual Smoke

  • Ran local disposable dev stack on PORT=3102, VITE_PORT=5175, VITE_ALLOWED_ORIGIN=http://localhost:5175, DATABASE_URL=sqlite:./.tmp/e2e-hmr.db, UPLOADS_DIR=./.tmp/e2e-hmr-uploads.
  • Opened /admin/site, completed local setup, loaded the Site editor body past the skeleton, added a base Container module, temporarily edited src/modules/base/container/ContainerEditor.tsx, and observed Vite HMR update the canvas placeholder without falling back to an endless skeleton. The temporary probe edit was reverted before commit.
@DavidBabinec DavidBabinec marked this pull request as ready for review June 26, 2026 15:04
@DavidBabinec DavidBabinec merged commit 100c12d into main Jun 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant