Skip to content

Commit 6f9a4af

Browse files
committed
feat: copilot review
1 parent 1b19a7a commit 6f9a4af

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ export class GroupedDataMapProvider {
6868
): Date | undefined {
6969
const groupData = this.getGroupFromDateTableGroupMap(groupIndex);
7070

71+
if (!groupData) {
72+
return undefined;
73+
}
74+
7175
const checkCellStartDate = (rowIndex: number, columnIndex: number): Date | undefined => {
7276
const { cellData } = groupData[rowIndex][columnIndex];
7377
let {
@@ -273,8 +277,7 @@ export class GroupedDataMapProvider {
273277
}
274278

275279
getCellsGroup(groupIndex: number): GroupLeaf['grouped'] | undefined {
276-
const { dateTableGroupedMap } = this.groupedDataMap;
277-
const groupData = dateTableGroupedMap[groupIndex];
280+
const groupData = this.getGroupFromDateTableGroupMap(groupIndex);
278281

279282
if (groupData) {
280283
const { cellData } = groupData[0][0];
@@ -308,7 +311,7 @@ export class GroupedDataMapProvider {
308311
.map(({ groupIndex }) => groupIndex);
309312
}
310313

311-
getGroupFromDateTableGroupMap(groupIndex: number): CellInfo[][] {
314+
getGroupFromDateTableGroupMap(groupIndex: number): CellInfo[][] | undefined {
312315
const { dateTableGroupedMap } = this.groupedDataMap;
313316

314317
return dateTableGroupedMap[groupIndex];
@@ -329,8 +332,7 @@ export class GroupedDataMapProvider {
329332
}
330333

331334
getLastGroupRow(groupIndex: number): CellInfo[] | undefined {
332-
const { dateTableGroupedMap } = this.groupedDataMap;
333-
const groupedData = dateTableGroupedMap[groupIndex];
335+
const groupedData = this.getGroupFromDateTableGroupMap(groupIndex);
334336

335337
if (groupedData) {
336338
const lastRowIndex = groupedData.length - 1;
@@ -343,9 +345,9 @@ export class GroupedDataMapProvider {
343345

344346
getLastGroupCellPosition(groupIndex: number): CellPositionData | undefined {
345347
const groupRow = this.getLastGroupRow(groupIndex);
348+
const lastCell = groupRow?.[groupRow.length - 1];
346349

347-
// eslint-disable-next-line no-unsafe-optional-chaining
348-
return groupRow?.[groupRow?.length - 1].position;
350+
return lastCell?.position;
349351
}
350352

351353
getRowCountInGroup(groupIndex: number): number {

0 commit comments

Comments
 (0)