Skip to content

Scheduler: refactor workspaces module (TS): part 4#33915

Merged
sjbur merged 24 commits into
DevExpress:26_1from
sjbur:issue-4485_26_1
Jun 11, 2026
Merged

Scheduler: refactor workspaces module (TS): part 4#33915
sjbur merged 24 commits into
DevExpress:26_1from
sjbur:issue-4485_26_1

Conversation

@sjbur

@sjbur sjbur commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@sjbur sjbur self-assigned this Jun 8, 2026
@sjbur sjbur added the 26_1 label Jun 8, 2026
@sjbur sjbur marked this pull request as ready for review June 9, 2026 15:05
@sjbur sjbur requested a review from a team as a code owner June 9, 2026 15:05
Copilot AI review requested due to automatic review settings June 9, 2026 15:05

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.

Pull request overview

Refactors the Scheduler workspaces “view model” layer as part of the ongoing TS migration/cleanup (part 4), primarily by renaming legacy m_* modules to non-prefixed modules and tightening type definitions across view data generation/mapping and time panel rendering.

Changes:

  • Renamed/retargeted imports from legacy m_* workspace/view_model modules to the new module names and consolidated type imports.
  • Strengthened typing for view data provider / grouped data map provider / time panel data generator (replacing multiple any usages with concrete scheduler types).
  • Updated scheduler shared types to use GroupLeaf['grouped'], added GroupInfo, and adjusted month/day/week generators to use typed options.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/view_data_provider.tests.js Updates test imports and aligns cell info shape (allDay field).
packages/devextreme/js/__internal/scheduler/workspaces/work_space_vertical.ts Updates view model options type import to new types module.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_provider.ts Renames imports and replaces any with scheduler view data/time panel/date header types.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_generator.test.ts Updates generator imports to new module names.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_generator_week.ts Adds typed options usage and adjusts first-day-of-week fallback logic.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_generator_timeline_month.ts Replaces any option typing with ViewDataProviderOptions.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_generator_month.ts Tightens types and refactors month generator internals (incl. today/otherMonth flags).
packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_generator_day.ts Uses typed ViewDataProviderOptions for start view date calculation.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/utils/view_provider_utils.ts Updates generator imports to new module names.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/types.ts Moves GroupLeaf type source and keeps workspace view-model-specific option shapes.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/time_panel_data_generator.ts Replaces any with explicit time panel/view cell types; refactors map generation return types.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_view_data_generator.ts Switches to new types import and tightens base generator typing.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/m_date_header_data_generator.ts Switches to new types import.
packages/devextreme/js/__internal/scheduler/workspaces/view_model/grouped_data_map_provider.ts Adds explicit types and refactors cell-position lookup logic.
packages/devextreme/js/__internal/scheduler/workspaces/timeline.ts Updates view model options type import path.
packages/devextreme/js/__internal/scheduler/workspaces/timeline_month.ts Updates view model options type import path.
packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts Switches to new ViewDataProvider module; simplifies findCellPositionInMap call sites.
packages/devextreme/js/__internal/scheduler/workspaces/helpers/position_helper.ts Updates provider import and hardens against missing last-group position.
packages/devextreme/js/__internal/scheduler/workspaces/cells_selection_state.ts Updates imports and passes full cell data to findCellPositionInMap.
packages/devextreme/js/__internal/scheduler/workspaces/cells_selection_controller.ts Exports EdgeIndices for reuse by view data provider.
packages/devextreme/js/__internal/scheduler/view_model/generate_view_model/steps/virtual_screen_filter.ts Updates provider import path.
packages/devextreme/js/__internal/scheduler/types.ts Refines scheduler-wide types: groups typing, GroupInfo, time panel cell/data types, startDate optionality.
packages/devextreme/js/__internal/scheduler/r1/utils/month.ts Adjusts month view start calculation to handle optional startViewDate.
packages/devextreme/js/__internal/scheduler/r1/utils/base.ts Tightens helper typings (incl. getToday) and loosens row-count helper input type.
packages/devextreme/js/__internal/scheduler/r1/components/types.ts Aligns groups typing with GroupLeaf['grouped'].
packages/devextreme/js/__internal/scheduler/r1/components/base/time_panel_table.tsx Updates time panel default props to match new TimePanelData shape.
packages/devextreme/js/__internal/scheduler/r1/components/base/cell.tsx Aligns groups typing with GroupLeaf['grouped'].
Comments suppressed due to low confidence (4)

packages/devextreme/js/__internal/scheduler/workspaces/view_model/grouped_data_map_provider.ts:148

  • findCellPositionInMap now uses flatMap(...).find(...), which allocates a flattened array of all cells before searching. This removes the early-exit behavior of the previous nested loops and can be a noticeable performance regression in large workspaces (cell search runs on selection/drag/keyboard paths). Consider iterating rows/cells directly and returning as soon as the match is found.
    packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_provider.ts:346
  • Explicitly initializing resultCellData to undefined and suppressing no-undef-init adds noise without changing behavior (the variable is undefined by default). This can be simplified by removing the eslint suppression and the redundant initialization.
    packages/devextreme/js/__internal/scheduler/r1/utils/base.ts:346
  • getToday is typed as requiring a TimeZoneCalculator, but the implementation uses optional chaining (timeZoneCalculator?.createDate) and some call sites pass potentially-undefined calculators (which is why other code now needs casts). Updating the parameter type to allow undefined will better reflect the actual contract and remove the need for unsafe casts elsewhere.
export const getToday = (
  indicatorTime: Date | undefined,
  timeZoneCalculator: TimeZoneCalculator,
): Date => {
  const todayDate = indicatorTime ?? new Date();

  return timeZoneCalculator?.createDate(todayDate, 'toGrid') || todayDate;
};

packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_generator_month.ts:49

  • indicatorTime/timeZoneCalculator are optional on ViewDataProviderExtendedOptions, but this code force-casts them to non-optional types to satisfy isCurrentDate. This weakens type safety and can hide real undefined flows. Prefer letting isCurrentDate accept optional values (and rely on getToday's fallback behavior) so casts are not needed.

return foundPosition;
}

private getRowsForCellSearch(

@sjbur sjbur Jun 10, 2026

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.

Added this helper function to simplify double "for" cycle in findCellPositionInMap function because eslint required to do so

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.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_provider.ts:346

  • Unnecessary no-undef-init lint suppression: local variables are undefined by default, so explicitly assigning = undefined (and disabling the rule) adds noise without changing behavior.
    packages/devextreme/js/__internal/scheduler/workspaces/view_model/grouped_data_map_provider.ts:147
  • Unnecessary no-undef-init lint suppression: foundPosition will be undefined by default, so the explicit = undefined can be removed and the eslint disable dropped.
    packages/devextreme/js/__internal/scheduler/workspaces/view_model/grouped_data_map_provider.ts:315
  • getGroupFromDateTableGroupMap can return undefined when groupIndex is out of range (array indexing), but the signature currently claims it always returns CellInfo[][]. This is type-unsound and forces callers to assume a group exists when it may not.

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings June 10, 2026 17:09

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.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

packages/devextreme/js/__internal/scheduler/workspaces/view_model/grouped_data_map_provider.ts:156

  • findCellPositionInMap now iterates with nested forEach, which cannot short‑circuit after a match is found. This changes behavior from the previous early-return implementation (it may return the last matching cell when index is undefined) and also does extra work on every call. Consider using Array#some / a for loop so the search stops on the first match (preserving prior traversal semantics and improving performance).

Copilot AI review requested due to automatic review settings June 11, 2026 08:40

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.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

packages/devextreme/js/__internal/scheduler/workspaces/view_model/grouped_data_map_provider.ts:273

  • isSameGroupIndexAndIndex compares cellData.groupIndex directly to the provided groupIndex. In findCellPositionInMap you already normalize the map lookup with groupIndex ?? 0, so if callers omit groupIndex (or pass undefined), the row set is taken from group 0 but the equality check will never match cells whose groupIndex is 0. Normalizing the comparison here keeps behavior consistent with the earlier gIdx fallback.
    packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_provider.ts:346
  • Avoid initializing a variable to undefined and suppressing no-undef-init. Declaring the variable without an initializer keeps the same runtime behavior and removes the need for an eslint disable.

const rows = isAllDay && !this.viewOptions.isVerticalGrouping
? allDayPanelGroupedMap[groupIndex] ? [allDayPanelGroupedMap[groupIndex]] : []
: dateTableGroupedMap[groupIndex] || [];
const gIdx = groupIndex ?? 0;

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.

minor: I suggest to use another var name: normalizedGroupIndex

Tucchhaa
Tucchhaa previously approved these changes Jun 11, 2026
Copilot AI review requested due to automatic review settings June 11, 2026 10:07

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.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

packages/devextreme/js/__internal/scheduler/workspaces/view_model/grouped_data_map_provider.ts:182

  • normalizedGroupIndex is used to choose rows, but the subsequent group/index comparison still uses the original groupIndex (which can be undefined on ungrouped views). In that case, the search iterates over group 0 rows but compares cellData.groupIndex === undefined, so the cell position will never be found.
    packages/devextreme/js/__internal/scheduler/workspaces/view_model/view_data_provider.ts:346
  • Avoid explicitly initializing to undefined here. It forces a no-undef-init suppression that can be removed by simply declaring the variable (it will be undefined by default).

@sjbur sjbur merged commit ecb93f7 into DevExpress:26_1 Jun 11, 2026
127 of 128 checks passed
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.

4 participants