Skip to content

Conversation

@iobuhov
Copy link
Collaborator

@iobuhov iobuhov commented Nov 13, 2025

Pull request type

Refactoring (e.g. file rename, variable rename, etc.)


Description

Copilot AI review requested due to automatic review settings November 13, 2025 14:19
@iobuhov iobuhov requested a review from a team as a code owner November 13, 2025 14:19
Copilot finished reviewing on behalf of iobuhov November 13, 2025 14:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the architecture of the datagrid widget's state management and dependency injection system, transitioning from a monolithic approach to a more modular, atom-based pattern using MobX computed values and event emitters.

Key Changes

  • Atom-based state management: Introduces granular, composable atoms for datasource properties, selection state, and empty state management
  • Event-driven select-all feature: Refactors SelectAllService and SelectAllBarViewModel to use an event emitter pattern instead of direct method calls
  • Dependency injection reorganization: Splits tokens into CORE_TOKENS, DG_TOKENS, and SA_TOKENS for better separation of concerns
  • Bug fix: Corrects clearInterval to clearTimeout in DatasourceService

Reviewed Changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/shared/widget-plugin-grid/src/utils/mobx-test-setup.ts Adds shared MobX test configuration file
packages/shared/widget-plugin-grid/src/selection-counter/tests/SelectionCounter.viewModel.spec.ts Updates tests to use new atom-based SelectionCounterViewModel
packages/shared/widget-plugin-grid/src/selection-counter/SelectionCounter.viewModel-atoms.ts Creates new atom-based ViewModel replacing gate-based approach
packages/shared/widget-plugin-grid/src/select-all/select-all.model.ts Introduces event types, emitter factory, and setup functions for select-all feature
packages/shared/widget-plugin-grid/src/select-all/select-all.feature.ts Adds feature class to coordinate select-all setup lifecycle
packages/shared/widget-plugin-grid/src/select-all/SelectAllBar.store.ts Creates observable store for select-all bar UI state
packages/shared/widget-plugin-grid/src/select-all/SelectAll.service.ts Refactors to use event emitter instead of progress service interface
packages/shared/widget-plugin-grid/src/core/models/selection.model.ts Extracts selection-related atoms and pure functions
packages/shared/widget-plugin-grid/src/core/models/empty-state.model.ts Adds atom for empty placeholder widgets
packages/shared/widget-plugin-grid/src/core/models/datasource.model.ts Extracts datasource-related atoms for items, offset, limit, total count
packages/shared/widget-plugin-grid/src/core/tests/*.spec.ts Adds comprehensive tests for new atom functions
packages/shared/widget-plugin-grid/src/core/Datasource.service.ts Fixes clearInterval/clearTimeout bug
packages/pluggableWidgets/datagrid-web/typings/MainGateProps.ts Reorganizes type alphabetically (contains duplicate "datasource" key)
packages/pluggableWidgets/datagrid-web/src/model/tokens.ts Restructures tokens into CORE_TOKENS, DG_TOKENS, and SA_TOKENS
packages/pluggableWidgets/datagrid-web/src/model/services/MainGateProvider.service.ts Adds custom GateProvider that blocks prop updates during progress operations
packages/pluggableWidgets/datagrid-web/src/model/models/columns.model.ts Extracts visible columns count atom
packages/pluggableWidgets/datagrid-web/src/model/hooks/useDatagridContainer.ts Updates to use new container initialization pattern
packages/pluggableWidgets/datagrid-web/src/model/hooks/injection-hooks.ts Updates token references
packages/pluggableWidgets/datagrid-web/src/model/containers/Root.container.ts Adds atom bindings and injected declarations
packages/pluggableWidgets/datagrid-web/src/model/containers/Datagrid.container.ts Refactors to accept dependencies through init method
packages/pluggableWidgets/datagrid-web/src/model/configs/Datagrid.config.ts Adds enableSelectAll to config
packages/pluggableWidgets/datagrid-web/src/features/selection-counter/injection-hooks.ts Updates token references
packages/pluggableWidgets/datagrid-web/src/features/select-all/injection-hooks.ts Updates token references
packages/pluggableWidgets/datagrid-web/src/features/select-all/SelectAllModule.container.ts Refactors module to use new dependency injection pattern
packages/pluggableWidgets/datagrid-web/src/features/select-all/SelectAllGateProps.ts Removes file (functionality moved to MainGateProps)
packages/pluggableWidgets/datagrid-web/src/features/select-all/SelectAllBar.viewModel.ts Refactors to use event emitter pattern
packages/pluggableWidgets/datagrid-web/src/features/empty-message/injection-hooks.ts Adds injection hook for empty placeholder VM
packages/pluggableWidgets/datagrid-web/src/features/empty-message/tests/EmptyPlaceholder.viewModel.spec.ts Adds tests for EmptyPlaceholderViewModel
packages/pluggableWidgets/datagrid-web/src/features/empty-message/EmptyPlaceholder.viewModel.ts Creates ViewModel for empty state grid column spanning
packages/pluggableWidgets/datagrid-web/src/features/empty-message/EmptyPlaceholder.tsx Adds React component for empty placeholder
packages/pluggableWidgets/datagrid-web/src/components/Widget.tsx Replaces inline empty placeholder with EmptyPlaceholder component
packages/pluggableWidgets/datagrid-web/src/Datagrid.tsx Removes emptyPlaceholderRenderer callback prop

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.

2 participants