Skip to content

Grids: type m_grid_view - #35598

Open
anna-shakhova wants to merge 3 commits into
DevExpress:mainfrom
anna-shakhova:type_grid_view_main
Open

anna-shakhova wants to merge 3 commits into
DevExpress:mainfrom
anna-shakhova:type_grid_view_main

Conversation

@anna-shakhova

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The master-detail resize callback can call .done() on an undefined result when the detail grid becomes invisible.

1 open finding
What changed in this PR

Adds stronger TypeScript typing to grid view and resizing logic while preserving existing behavior.

Changes:

  • Types grid view controllers, methods, deferreds, and view lookups.
  • Replaces legacy iterator patterns with typed array operations.
  • Updates master-detail handling for the typed updateDimensions result.
File Description
packages/​devextreme/​js/​__internal/​grids/​grid_core/​views/​m_grid_view.ts Adds types and modernizes grid sizing/view logic.
packages/​devextreme/​js/​__internal/​grids/​grid_core/​master_detail/​m_master_detail.ts Adapts master-detail resizing to the new return type.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@anna-shakhova
anna-shakhova marked this pull request as ready for review October 9, 2026 14:20
@anna-shakhova
anna-shakhova requested a review from a team as a code owner October 9, 2026 14:20
Copilot AI balanced review requested due to automatic review settings October 9, 2026 14:20
): ModuleType<ResizingController> => class AdaptivityResizingViewControllerExtender extends Base {
public dispose() {
super.dispose.apply(this, arguments as any);
clearTimeout(this._updateScrollableTimeoutID);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

_updateScrollableTimeoutID was never set, so remove unnecessary method overload

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The typing refactor preserves existing behavior and adds focused coverage for the affected width calculations.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

Comment on lines +597 to +601
// @ts-expect-error columns without a width have best-fit widths here
resultSizes[i] += diffElement;
if (onePixelElementsCount > 0) {
if (onePixelElementsCount < 1) {
resultSizes[i] += onePixelElementsCount;
onePixelElementsCount = 0;
} else {
resultSizes[i]++;
onePixelElementsCount--;
}
if (onePixelElementsCount > 0 && onePixelElementsCount < 1) {
// @ts-expect-error columns without a width have best-fit widths here
resultSizes[i] += onePixelElementsCount;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the += 1 branch already became Number(resultSizes[i]) + 1. Could the two += lines take the same form, so both @ts-expect-error go away? The values here are numbers either way

Suggested change
// @ts-expect-error columns without a width have best-fit widths here
resultSizes[i] += diffElement;
if (onePixelElementsCount > 0) {
if (onePixelElementsCount < 1) {
resultSizes[i] += onePixelElementsCount;
onePixelElementsCount = 0;
} else {
resultSizes[i]++;
onePixelElementsCount--;
}
if (onePixelElementsCount > 0 && onePixelElementsCount < 1) {
// @ts-expect-error columns without a width have best-fit widths here
resultSizes[i] += onePixelElementsCount;
resultSizes[i] = Number(resultSizes[i]) + diffElement;
if (onePixelElementsCount > 0 && onePixelElementsCount < 1) {
resultSizes[i] = Number(resultSizes[i]) + onePixelElementsCount;

}

const createResizingController = (): ResizingControllerInternals => {
const controller = Object.create(ResizingController.prototype) as ResizingControllerInternals;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Object.create skips the constructor and init(), so these tests may break if the methods start using another field. Could we move this width math into pure functions and test them directly?

Comment on lines +320 to 322
// @ts-expect-error updateDimensions() returns undefined only for an invisible grid
// eslint-disable-next-line @typescript-eslint/no-misused-promises -- ignores the result
this.updateDimensions().done(() => d.resolve(true));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

updateDimensions() returns undefined for an invisible grid, so .done would throw here. What do you think about when(...) like in resize(), instead of @ts-expect-error?

Suggested change
// @ts-expect-error updateDimensions() returns undefined only for an invisible grid
// eslint-disable-next-line @typescript-eslint/no-misused-promises -- ignores the result
this.updateDimensions().done(() => d.resolve(true));
when(this.updateDimensions()).done(() => {
d.resolve(true);
});

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants