Skip to content

Fix: Cannot read properties of undefined (reading 'offsetHeight') (T1321478)#32868

Open
ajivanyandev wants to merge 3 commits intoDevExpress:26_1from
ajivanyandev:cp-26-1/fix-undefined-element-offset
Open

Fix: Cannot read properties of undefined (reading 'offsetHeight') (T1321478)#32868
ajivanyandev wants to merge 3 commits intoDevExpress:26_1from
ajivanyandev:cp-26-1/fix-undefined-element-offset

Conversation

@ajivanyandev
Copy link
Contributor

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a runtime error in DevExtreme’s internal animation/positioning utilities that could occur when APIs are invoked with an empty/unmounted element (e.g., after a widget is removed from the DOM).

Changes:

  • Removed the offsetHeight read in resetPosition that could throw when the wrapped element is missing.
  • Added an early return in position (m_position.setup) when the target element doesn’t exist.
  • Added Jest coverage for resetPosition and positionUtils.setup with missing/empty elements.

Reviewed changes

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

File Description
packages/devextreme/js/__internal/common/core/animation/translator.ts Avoids crashing when finishing a transition on an empty wrapper by removing the offsetHeight access.
packages/devextreme/js/__internal/common/core/animation/translator.test.ts Adds Jest tests ensuring resetPosition(..., true) doesn’t throw for missing/empty elements.
packages/devextreme/js/__internal/common/core/animation/m_position.ts Returns undefined early when what resolves to an empty element wrapper, preventing downstream errors.
packages/devextreme/js/__internal/common/core/animation/m_position.test.ts Adds Jest tests for positionUtils.setup behavior with missing/empty elements (currently only for the no-options path).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants