There is an error when destroy a date-picker instance
See original GitHub issueDetailed description
we have 2 tabs in a page, and one tab has a component which there is a datepicker in it, If we don’t choose the tab contained date-picker, and navigate to another page, there is an error when destroy the date-picker
Describe in detail the issue you’re having.
Is this a feature request (new component, new icon), a bug, or a general issue? component Is this issue related to a specific component? ibm-date-picker What did you expect to happen? What happened instead? What would you like to see changed? when navigate to another page and need to call ngDestroy What browser are you working in? Chrome What version of the Carbon Design System are you using? 3.14.2 What offering/product do you work on? Any pressing ship or release dates we should be aware of?
Steps to reproduce the issue
- we have 2 pages, 1st is homepage, 2nd is a tab page which have 2tabs, and Tab2 has a component, which contains a datepicker component.
- visit homepage, then visit the tabpage which has tab1 as default,
- Click back icon ‘<-’ to return to homepage
- The error appears
Additional information
-
Screenshots or code
-
Notes
this.flatpickrInstance
is an Array, when to runthis.flatpickrInstance.destroy();
we need to check the length ofthis.flatpickrInstance
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Congrats on opening the 700th issue 🎉
Also
this.flatpickrInstance
isn’t an array, or at least it shouldn’t be. checking!this.flatpickrInstance && !this.flatpickrInstance.destroy
should be sufficient. If you’d like to open a PR with the fix that would be amazing.Thank you very much for your quickly support!