Skip to content

refactor(datagrid-web): tidy up stores and remove narrating comments - #2554

Closed
iobuhov wants to merge 1 commit into
mainfrom
iobuhov/datagrid-tidy-ups
Closed

iobuhov wants to merge 1 commit into
mainfrom
iobuhov/datagrid-tidy-ups

Conversation

@iobuhov

@iobuhov iobuhov commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Tidy-ups in DataGrid with no behaviour change.

  • GridPersonalizationStore: the schema version is declared once, as the SCHEMA_VERSION constant, and used by both the settings check and toStorageFormat.
  • PersonalizationStorage.updateSettings takes unknown instead of any. Neither implementation needed narrowing, because both only pass the value to JSON.stringify.
  • ColumnGroupStore: availableColumns and visibleColumns no longer copy the array before .filter.
  • ColumnsSortingStore.getDirection reads the rule by index once instead of using .at(...)! after findIndex.
  • ColumnFilterStore: the constructor's three result branches are now one if/else, and the unused dsViewState parameter of createFilterStore is removed. It was always null, and null is still passed to attrgroupFilterStore.
  • Removed comments that only narrated the code: section banners in ColumnStore and GridColumn, "normalize columns", "check if all columns loaded" and the branch comments in toggleSort. Comments that explain why were kept.
  • Moved useDataGridJSActions from helpers/ to model/hooks/ and updated its imports.

This does not conflict with #2553 (dead-code removal) and is based on main. Typecheck, lint and unit tests (263) pass. No changelog entry, because users see no change.

🤖 Generated with Claude Code

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 13:09
@github-actions

Copy link
Copy Markdown
Contributor

AI Code Review

✅ Approved — no issues found


What was reviewed

File Change
datagrid-web/src/helpers/state/* (ColumnGroupStore, ColumnsSortingStore, GridPersonalizationStore, column/ColumnFilterStore, column/ColumnStore) Tidy-ups: SCHEMA_VERSION constant, no redundant array copies, simpler getDirection, simpler constructor branching, removed narrating comments
datagrid-web/src/helpers/storage/* updateSettings(newSettings: unknown) instead of any
datagrid-web/src/model/hooks/useDataGridJSActions.ts, Datagrid.tsx Hook moved, imports updated (no other references remain)
datagrid-web/src/typings/GridColumn.ts Removed section comments

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

CI: pending: E2E (0), E2E (1), code quality check, sigridci, Snyk code · unrelated failures: security/snyk (external scanner)


Positives

  • The refactors preserve behavior. rules[-1] is undefined, so getDirection still returns undefined for a missing column. The ColumnFilterStore branches still leave the same _error and _filterStore values.
  • SCHEMA_VERSION is now declared once, which removes the duplicated literal 3.
  • No changelog entry is needed, since the change is a refactor with no user-visible behavior change.

@iobuhov

iobuhov commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: this change is already on main (44f3b37, landed with #2559).

@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