Skip to content

bug(data-weaver): resolve production build failures caused by circular module dependencies - #452

Open
nick-nlb wants to merge 2 commits into
datacommonsorg:mainfrom
nick-nlb:dw-build-fixes
Open

bug(data-weaver): resolve production build failures caused by circular module dependencies#452
nick-nlb wants to merge 2 commits into
datacommonsorg:mainfrom
nick-nlb:dw-build-fixes

Conversation

@nick-nlb

Copy link
Copy Markdown
Collaborator

Overview

This PR resolves production build failures caused by circular dependencies.

Description

Recent additions to the application introduced circular dependencies that caused build-time failures in Next.js. These were not picked up in development mode (pnpm dev) the way dev mode imports at run time masked the cycles in the import dependency graph.

The changes in this PR resolve those build-time issues and add unit tests for the refactored code.

Follow-ups

The following tasks will be follow-ups to this PR (and have been added to the tracker):

  • Update README.md to document required verification steps before PR submission and merging.
  • Apply formatting alignment (separated to keep this PR diff minimal).
  • Add a CI workflow to enforce build, lint, and test success prior to merge.

Tests performed

  • Added unit test suite covering snapToGrid utility (snap_to_grid.test.ts).
  • Verified type checks, Biome linter, and Stylelint pass: nvm use && pnpm lint.
  • Verified all unit tests pass: nvm use && pnpm test (46 tests passing).
  • Verified production build and static page generation succeed: nvm use && pnpm build.

Testing

To test this PR (and demonstrate the original issue), perform the following:

  • Switch to main
  • Run pnpm build
  • Run pnpm preview
  • Visit http://localhost:3000
  • Result: The application errors out on load
  • Switch to this branch
  • Run pnpm build
  • Run pnpm preview
  • Visit http://localhost:3000
  • Result: The application loads and functions successfully

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors card components by replacing namespace component references with direct imports, and extracts card configuration constants and the snapToGrid utility into dedicated, reusable files with unit tests. Feedback on these changes includes utilizing the satisfies operator with as const on the card size configurations to preserve exact literal types, and adding a defensive guard clause in snapToGrid to prevent division-by-zero errors if a non-positive grid size is provided.

Comment thread dataweaver/apps/web/src/components/elements/card/config.ts Outdated
Comment thread dataweaver/apps/web/src/functions/snap_to_grid.ts Outdated
@nick-nlb
nick-nlb marked this pull request as ready for review August 27, 2026 18:20
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