Skip to content

refactor(datagrid-web): restructure src into feature folders - #2556

Closed
iobuhov wants to merge 14 commits into
mainfrom
iobuhov/datagrid-feature-folders
Closed

iobuhov wants to merge 14 commits into
mainfrom
iobuhov/datagrid-feature-folders

Conversation

@iobuhov

@iobuhov iobuhov commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Restructures packages/pluggableWidgets/datagrid-web/src into feature folders. Moves only: every file is moved with git mv, and the only edits are import paths (plus prettier re-wrapping and import-x/order re-sorting of those import lines). No logic, names or exports change.

Depends on #2553 and #2554. #2553 is already in main. #2554 is merged into this branch so that helpers/ could be emptied. This diff will shrink once #2554 merges.

Read it commit by commit. Each area is one commit, and git shows every file as a rename (git diff --stat -M: 98 renames, 8 files with import-line edits only, nothing else).

New tree

src/
├── Datagrid.tsx, Datagrid.xml, Datagrid.editorConfig.ts, Datagrid.editorPreview.tsx
├── Datagrid.icon*.png, Datagrid.tile*.png, package.xml, consistency-check.ts, jest.setup.ts
├── __tests__/                consistency-check.spec.ts, snapshot.ts, test-utils.tsx
├── core/
│   ├── tokens.ts
│   ├── configs/              Datagrid.config.ts (+ __tests__)
│   ├── containers/           Datagrid.container.ts, Root.container.ts, createDatagridContainer.ts (+ __tests__)
│   ├── hooks/                injection-hooks.ts, useDatagridContainer.ts, useDataGridJSActions.ts
│   └── services/             DatagridSetup.service.ts, MainGateProvider.service.ts, Texts.service.ts
├── features/
│   ├── columns/              ColumnStore, BaseColumnInfo, ColumnGroupStore, columns.model, grid.model, GridColumn,
│   │                         ColumnProvider, ColumnResizer, ColumnSelector, GridHeader, Header (+ __tests__)
│   ├── data-export/          (existing) + ExportAlert.tsx
│   ├── datasource/           DatasourceParamsController, DerivedLoaderController, rows.model, RefreshStatus,
│   │                         loader/* (+ __tests__)
│   ├── empty-message/        (unchanged)
│   ├── filtering/            ColumnFilterStore.tsx, static-info.ts
│   ├── pagination/           pagination.config, PageSize.store, GridSize.store, Pagination.tsx,
│   │                         useInfiniteControl.tsx (+ __tests__)
│   ├── personalization/      GridPersonalizationStore, personalization-settings, columns-hash, storage/*
│   ├── preview/              ColumnPreview.tsx, ColumnBase.ts, DatagridPreview.scss
│   ├── row-interaction/      (unchanged)
│   ├── selection/            SelectionGate.service, CheckboxCell, CheckboxColumnHeader, SelectorCell (+ __tests__),
│   │                         counter/ (was features/selection-counter), select-all/ (was features/select-all)
│   └── sorting/              ColumnsSortingStore.ts, sorting.ts
└── ui/                       Widget*, Grid, GridBody, Row, RowsRenderer, CellElement, DataCell, PseudoModal,
                              WidgetRoot.viewModel.ts, CellComponent.ts, icons/ (+ __tests__)

helpers/, components/, model/, utils/, src/typings/ and features/base/ are gone. The generated XML typings stay in the package-level typings/. src/typings/ held only hand-written files, so it was removed.

Placement decisions and deviations

  • Files keep their names. Moves into feature folders are flat: components/Pagination.tsx → features/pagination/Pagination.tsx, not features/pagination/components/. This matches the existing feature folders, such as data-export/ExportProgressDialog.tsx. Subfolders stay only where a group already existed (loader/, storage/, icons/). Core keeps its configs/, containers/, hooks/ and services/ subfolders.
  • useDataGridJSActions → core/hooks/. It is widget-wide, because it wires both the reset-filters and clear-selection external events.
  • grid.model.ts → features/columns/. It builds the grid-template-columns style from ColumnGroupStore and GridColumn.
  • GridSize.store.ts → features/pagination/. It imports pagination.config, bumps pages for virtual scrolling, and is used mainly by useInfiniteControl.
  • features/base/WidgetRoot.viewModel.ts → ui/, next to WidgetRoot.tsx, its only view.
  • typings/CellComponent.ts → ui/. Its only importers are Row and DataCell.
  • typings/static-info.ts → features/filtering/. It holds the filters channel info and is imported by ColumnFilterStore and ColumnGroupStore. Columns already depend on filtering.
  • typings/sorting.ts and typings/personalization-settings.ts keep their basenames inside their features (sorting/sorting.ts, personalization/personalization-settings.ts).
  • utils/test-utils.tsx → src/__tests__/test-utils.tsx, next to the existing snapshot.ts test fixture.
  • ui/DatagridPreview.scss → features/preview/, so ui/ is now the generic components folder.

Checks

  • Searched the whole repo for references to the moved paths. Nothing outside src refers to them, apart from historical notes in already-completed spec changes, which were left as they are. The one package-absolute self-import (@mendix/datagrid-web/src/... in useInfiniteControl) was updated.
  • tsc --noEmit, pnpm run lint (0 errors, 10 warnings, none new), pnpm run test (22 suites, 263 tests, 13 snapshots pass, none obsolete), pnpm turbo build all pass.
  • No changelog entry, because there is no user-facing change.

🤖 Generated with Claude Code

iobuhov and others added 14 commits November 24, 2026 14:08
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lization

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iobuhov
iobuhov requested a review from a team as a code owner November 24, 2026 14:30
@github-actions

Copy link
Copy Markdown
Contributor

AI Code Review

✅ Approved — no issues found


What was reviewed

File Change
packages/pluggableWidgets/datagrid-web/src/** (about 100 files) Files moved into core/, features/ and ui/ folders, with import paths updated
datagrid-web/src/features/{filtering,sorting,personalization,columns}/* Small edits that come from the merged #2554 (see below)

Skipped (out of scope): snapshots (renames only), dist/, pnpm-lock.yaml

CI: pending: Run automated end-to-end tests, Run code quality check, sigridci · unrelated failures: security/snyk (external scanner, no code issues reported)


Positives

  • The restructure follows the existing feature-folder convention (flat moves, subfolders only where one already existed). The PR description documents every placement decision.
  • Every import path in the diff resolves to a moved file. I found no leftover references to the old helpers/, model/ or utils/ paths. The package-absolute self-import in useInfiniteControl.spec was updated.
  • I read the non-import edits that came in with refactor(datagrid-web): tidy up stores and remove narrating comments #2554 and they preserve behavior:
    • ColumnFilterStore's constructor and filter-store creation are equivalent after the simplification.
    • rules[ruleIndex] in ColumnsSortingStore returns the same result as the old -1 guard.
    • Hoisting SCHEMA_VERSION keeps the same value, 3.
    • Changing any to unknown on updateSettings is type-only.
    • Removing the narration comments matches the repo's comment rules.

@iobuhov

iobuhov commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: replaced by the stacked restructure PRs.

@iobuhov iobuhov closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant