-
Notifications
You must be signed in to change notification settings - Fork 59
Pre dynamic page changes #1982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Pre dynamic page changes #1982
Conversation
There was a problem hiding this 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, andSA_TOKENSfor better separation of concerns - Bug fix: Corrects
clearIntervaltoclearTimeoutin 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 |
packages/shared/widget-plugin-grid/src/select-all/SelectAll.service.ts
Outdated
Show resolved
Hide resolved
packages/pluggableWidgets/datagrid-web/src/features/empty-message/EmptyPlaceholder.viewModel.ts
Show resolved
Hide resolved
packages/pluggableWidgets/datagrid-web/src/model/containers/Root.container.ts
Outdated
Show resolved
Hide resolved
packages/pluggableWidgets/datagrid-web/typings/MainGateProps.ts
Outdated
Show resolved
Hide resolved
packages/pluggableWidgets/datagrid-web/src/model/services/MainGateProvider.service.ts
Show resolved
Hide resolved
packages/shared/widget-plugin-grid/src/core/__tests__/selectedCountMulti.spec.ts
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
Pull request type
Refactoring (e.g. file rename, variable rename, etc.)
Description