Skip to content

Scheduler: T1308596 — "Uncaught TypeError: Cannot read properties of undefined (reading 'getBoundingClientRect')" is thrown when dragging an appointment while an onAppointmentUpdating promise is pending#31572

Merged
sjbur merged 14 commits into
DevExpress:25_2from
sjbur:issue-2112_25_2
Nov 10, 2025

Conversation

@sjbur

@sjbur sjbur commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@sjbur sjbur self-assigned this Nov 4, 2025
@sjbur sjbur added the 25_2 label Nov 4, 2025
@sjbur sjbur marked this pull request as ready for review November 5, 2025 07:17
@sjbur sjbur requested a review from a team as a code owner November 5, 2025 07:17
Copilot AI review requested due to automatic review settings November 5, 2025 07:17

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

This PR fixes a bug in the Scheduler component where attempting to drag an appointment while it's already being dragged causes a runtime error. The fix includes both code and styling changes to prevent the error.

  • Added null check for getFocusedCell() to prevent accessing properties on undefined
  • Added CSS rule to disable pointer events on dragged appointments
  • Added regression test to verify drag-during-drag scenario doesn't throw errors

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts Added null check before accessing cellData property to prevent undefined access error
packages/devextreme-scss/scss/widgets/base/scheduler/appointment/regular/_index.scss Added pointer-events: none to drag source appointments to prevent interaction during drag
e2e/testcafe-devextreme/tests/scheduler/common/dragAndDrop/T1308596.ts Added regression test for drag-during-drag scenario with async promise delay

Comment thread e2e/testcafe-devextreme/tests/scheduler/common/dragAndDrop/T1308596.ts Outdated
Comment thread e2e/testcafe-devextreme/tests/scheduler/common/dragAndDrop/T1308596.ts Outdated

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.

I noticed that we have e2e tests named after ticket numbers. I’m not fully convinced this naming convention is ideal — it makes it hard to understand what the test actually does without referring to an external ticket.

Regarding this specific test: it feels a bit overengineered to me. It’s testing a negative scenario — something that ideally shouldn’t even happen. In e2e tests we usually want to focus on the positive, expected path, not exceptions.

In my opinion, this test belongs in the code workspace tests instead. I’d suggest moving it there.

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.

I moved test to a different file, e2e/testcafe-devextreme/tests/scheduler/common/dragAndDrop/dragEvents.ts

I think it is related to drag & drop, because the error occurs only during dragging the appointment.

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.

Also I optimized the test, hope it looks a bit better now

Copilot AI review requested due to automatic review settings November 7, 2025 11:36

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 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread packages/devextreme/js/__internal/scheduler/m_scheduler.ts
Copilot AI review requested due to automatic review settings November 7, 2025 12:13

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 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread packages/devextreme/js/__internal/scheduler/m_scheduler.ts Outdated
Comment thread packages/devextreme/js/__internal/scheduler/m_scheduler.ts Outdated
Copilot AI review requested due to automatic review settings November 7, 2025 17:02

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 4 out of 4 changed files in this pull request and generated 2 comments.

e.cancel = true;
return;
}

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

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

Missing check for _isAppointmentBeingUpdated() in createDragEndHandler. If an appointment update starts during a drag operation (between dragMove and dragEnd), the dragEnd handler will proceed without checking if the appointment is being updated. This could lead to inconsistent state or race conditions. Add the same _isAppointmentBeingUpdated() check after the appointmentInfo null check for consistency with dragStart and dragMove handlers.

Suggested change
if (this.scheduler._isAppointmentBeingUpdated(this.appointmentInfo.appointment)) {
e.cancel = true;
return;
}

Copilot uses AI. Check for mistakes.
Comment on lines 1780 to 1784
} catch (err) {
performFailAction(err);
this._updatingAppointments.delete(target);
deferred.resolve();
}

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

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

If the .fail() handler at line 1779 executes, performFailAction() is called but this._updatingAppointments.delete(target) is not. This means the appointment will remain in the tracking Set indefinitely, permanently blocking future drag operations for that appointment. The .always() handler at lines 1775-1778 only runs for successful promise creation, not for promise rejection. Consider moving the delete() call to ensure it executes in all failure scenarios.

Copilot uses AI. Check for mistakes.
@sjbur sjbur changed the title T1308596 - Scheduler - "Uncaught TypeError: Cannot read properties of undefined (reading 'getBoundingClientRect')" is thrown when dragging an appointment while an onAppointmentUpdating promise is pending Scheduler: T1308596 — "Uncaught TypeError: Cannot read properties of undefined (reading 'getBoundingClientRect')" is thrown when dragging an appointment while an onAppointmentUpdating promise is pending Nov 10, 2025
@sjbur sjbur merged commit 94e0ecb into DevExpress:25_2 Nov 10, 2025
99 of 101 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.

3 participants