Skip to content

refactor(datagrid-web): layout 3/4: tokens.ts as each feature's public surface - #2577

Open
iobuhov wants to merge 11 commits into
mainfrom
datagrid-layout-4-tokens
Open

iobuhov wants to merge 11 commits into
mainfrom
datagrid-layout-4-tokens

Conversation

@iobuhov

@iobuhov iobuhov commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Part 3/4 of the datagrid-web restructure. Code change, no behaviour change. This is not a move-only PR.

Each feature's public surface is now one tokens.ts, which holds:

  • its token objects,
  • the injection hooks over them,
  • the types other features need from it.

There are no index.ts barrels. features/core no longer imports any feature or the composition root.

Changes

  • Tokens. DG_TOKENS is split into a tokens.ts per feature: COLUMNS_TOKENS, DATASOURCE_TOKENS, DATA_EXPORT_TOKENS, EMPTY_MESSAGE_TOKENS, PAGINATION_TOKENS, PERSONALIZATION_TOKENS, ROW_INTERACTION_TOKENS and SELECTION_TOKENS. SA_TOKENS moves to selection/select-all/tokens.ts, and the root VM token moves to src/tokens.ts (ROOT_TOKENS). CORE_TOKENS stays in features/core/tokens.ts without columnsStore and column, which move to COLUMNS_TOKENS. Token keys and token names (the brandi description strings) are unchanged. Token generics use import type.
  • Hooks. core/hooks/injection-hooks.ts and the per-folder injection-hooks.ts files are merged into the matching tokens.ts.
  • Types. columns/tokens.ts re-exports ColumnGroupStore, IColumnGroupStore, GridColumn, ColumnId, the sort types and the column settings types. pagination/tokens.ts re-exports GridSizeStore. The type-only cross-feature imports (datasource, data-export, personalization -> columns; columns -> pagination) now use import type from those files.
  • Bindings. The binding groups move out of Datagrid.container.ts into <feature>.bindings.ts files. The BindingGroup interface moves to features/core/binding-group.ts, with a Deps type parameter so that a feature declares only the init dependencies it reads. The container keeps a root group (mainGate, config, export progress, the root VM) and composes the feature groups.
  • Removed. useQueryService and useClickActionHelper had no callers.

Why the behaviour is unchanged

brandi tokens are identified by object, so moving a token to another object does not change any binding. The binding groups keep the original order of init and postInit steps:

  1. root: bind mainGate, config, exportProgressService; postInit gets paramsService and gridSizeStore
  2. datasource (the old core datasource part + filter + loader groups): bind queryGate, refreshInterval, parentChannelName, combinedFilterConfig, loaderConfig; postInit hydrates the filters
  3. columns, empty-message: inject/define only
  4. personalization, pagination, selection, row-interaction, select-all, in the same order as before

Only inject and define calls change groups, and their order does not matter. The filter group is now part of datasource, because the combined filter feeds the datasource query. SelectActionsProvider moves from the row-interaction group to selection, which owns selectActions.

Chain

  1. personalization: refactor(datagrid-web): structure 2/12: personalization #2560
  2. move src to the feature layout (move only): refactor(datagrid-web): move src to feature layout #2579
  3. tokens, bindings and hooks per feature: refactor(datagrid-web): layout 3/4: tokens.ts as each feature's public surface #2577
  4. boundary lint rule: refactor(datagrid-web): layout 4/4: boundary lint rule #2578

Checks

Verified locally at this commit in packages/pluggableWidgets/datagrid-web: tsc --noEmit, pnpm run lint (0 errors, the same 10 warnings as the base), pnpm run test (22 suites, 263 tests pass) and pnpm turbo build. A dependency-graph check over src finds no import cycles. No changelog entry, because there is no user-facing change.

🤖 Generated with Claude Code

@github-actions

This comment has been minimized.

@iobuhov
iobuhov force-pushed the datagrid-layout-3-misplaced branch from 1bda427 to e350d0c Compare November 24, 2026 15:26
@iobuhov
iobuhov force-pushed the datagrid-layout-4-tokens branch from 422b4dd to 1a933fd Compare November 24, 2026 15:26
@iobuhov iobuhov changed the title refactor(datagrid-web): layout 4/5: tokens, bindings and hooks per feature refactor(datagrid-web): layout 4/5: tokens.ts as each feature's public surface Nov 24, 2026
@github-actions

This comment has been minimized.

@iobuhov
iobuhov changed the base branch from datagrid-layout-3-misplaced to datagrid-feature-layout November 24, 2026 15:35
@iobuhov
iobuhov force-pushed the datagrid-layout-4-tokens branch from 1a933fd to 711dd6e Compare November 24, 2026 15:35
@iobuhov iobuhov changed the title refactor(datagrid-web): layout 4/5: tokens.ts as each feature's public surface refactor(datagrid-web): layout 3/4: tokens.ts as each feature's public surface Nov 24, 2026
@github-actions

This comment has been minimized.

iobuhov and others added 4 commits November 24, 2026 16:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es/columns

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 and others added 7 commits November 24, 2026 16:40
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>
…__tests__

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move declarations between files, without changing them:
- sorting.ts types (SortInstruction, SortDirection, SortRule) fold into
  columns/GridColumn.ts (GridColumn <-> sorting cycle)
- IColumnParentStore moves to ColumnStore.tsx, and the sort rule
  converters move to ColumnGroupStore.ts, their only caller
  (ColumnGroupStore -> ColumnsSortingStore -> ColumnStore cycle)
- ColumnPersonalizationSettings and ColumnFilterSettings move from
  personalization-settings.ts to columns/column-settings.ts
- SelectionMethod moves from row-interaction/base.ts to
  features/core/configs/Datagrid.config.ts

Other edits are import lines only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each feature now owns a tokens.ts with its token objects, the injection
hooks over them and the types other features need, plus its binding
group (<feature>.bindings.ts). features/core keeps only CORE_TOKENS and
their hooks. The root containers compose the feature binding groups in
the same order as before. Cross-feature type imports go through
tokens.ts with import type.

Remove the uncalled useQueryService and useClickActionHelper hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iobuhov
iobuhov force-pushed the datagrid-feature-layout branch from 802b05b to d4b953b Compare November 24, 2026 15:40
@iobuhov
iobuhov force-pushed the datagrid-layout-4-tokens branch from 711dd6e to 07011b1 Compare November 24, 2026 15:40
@github-actions

Copy link
Copy Markdown
Contributor

AI Code Review

✅ Approved — no issues found


What was reviewed

File Change
datagrid-web/src/Datagrid.container.ts The container keeps only the root binding group. It composes the per-feature groups in the original order.
datagrid-web/src/features/*/tokens.ts DG_TOKENS is split into per-feature token objects. The injection hooks and cross-feature types are merged into each tokens.ts.
datagrid-web/src/features/*/*.bindings.ts Binding groups moved out of the container. BindingGroup now takes a Deps type parameter (features/core/binding-group.ts).
datagrid-web/src/tokens.ts, Root.container.ts New ROOT_TOKENS. The root container now imports from the feature tokens.ts files.
datagrid-web/src/*.tsx, other features/** Imports now point at the feature tokens.ts files. The unused useQueryService and useClickActionHelper hooks were removed.
datagrid-web/src/**/__tests__/*.spec.ts(x) Import paths only.

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

CI: pending: triage · unrelated failures: security/snyk (external scanner; the code and license Snyk checks pass). No build or test workflows appear in the check list, so they probably haven't run yet.


Questions

  • The PR description says tsc, lint, tests and build were run locally. Can you confirm the repo's own CI workflows also run once they're approved? No unit or E2E checks have reported on this PR so far.

Positives

  • I compared the new bindings with the old container. The init and postInit order is preserved. The root group still binds mainGate and config before the datasource group calls container.get(COLUMNS.columnsStore). The filter hydration still runs after the paramsService and gridSizeStore postInit.
  • Token keys and brandi description strings are unchanged, so existing bindings keep resolving. Type-only cross-feature imports use import type.
  • No changelog entry is needed for this internal refactor, and the PR says so.

Base automatically changed from datagrid-feature-layout to main November 24, 2026 16:59

This branch has not been deployed

No deployments
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