siemens / ix

Siemens Industrial Experience is a design system for designers and developers, to consistently create the perfect digital experience for industrial software products.
https://ix.siemens.io/
MIT License
206 stars 68 forks source link

[React] IxDateDropdown null pointer after switching to custom range and back #1555

Open OG84 opened 6 days ago

OG84 commented 6 days ago

Prerequisites

What happened?

When using the IxDateDropdown, there is some kind of null pointer exception when you do the following:

This raises

Uncaught TypeError: Cannot read properties of undefined (reading 'isPresent')
    at DropdownController.dismiss (@siemens_ix-react.js?v=1f08deba:5141:18)
    at DropdownController.dismissChildren (@siemens_ix-react.js?v=1f08deba:5137:12)
    at DropdownController.dismiss (@siemens_ix-react.js?v=1f08deba:5142:12)
    at toggleController (@siemens_ix-react.js?v=1f08deba:5370:28)
    at Button2.<anonymous> (@siemens_ix-react.js?v=1f08deba:5376:9)

In production this will just log an error to the console, but in development this error will break the app due to the error message.

This not only happens when clicking the drop down button itself, but also when clicking outside the drop down. Looks like there is some null check missing in the drop down controller.

Current workaround I'm using: unique key prop on the IxDateDropdown which consists of all dynamically provided props. So the Dropdown is unmounted and re-mounted whenever it's props change.

What type of frontend framework are you seeing the problem on?

React

Which version of iX do you use?

v2.5.0

Code to produce this issue.

https://stackblitz.com/edit/tcjojk?file=src%2FApp.tsx

or

https://ix.siemens.io/docs/controls/date-dropdown/#with-user-defined-range-options
github-actions[bot] commented 1 day ago

🤖 Hello @OG84

Your issue will be analyzed and is part of our internal workflow. To get informed about our workflow please checkout the Contributing Guidelines

JIRA: IX-1962