bulma-calendar
bulma-calendar copied to clipboard
TypeError after calendar Destroy - this._ui is null Error v6.1.18
Your issue may already be reported! Please search on the issue track before creating one.
- [x] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
- [x] Are you running the latest version?
- [x] Are you reporting to the correct repository?
Bug Report
Environment
- Bulma Calendar version: [e.g. v6.1.18]
- OS: [Windows 11, Garuda Linux x86_64 kernel 6.1.8-zen1-1-zen]
- Browser: [all]
- How you are customizing the extension: [no]
Current Behavior When destroying calendar component, an error "TypeError: this._ui is null" is thrown in the document onclick event handler "onDocumentClickDateTimePicker".
The issue is present in versions above 6.1.0, but switching to version 6.1.0 solves the problem.
Possible Solution I guess that I can debug and fix this problem and I'm happy to do it, but first please please confirm that this is indeed the problem and not me doing something wrong :)
Additional context/Screenshots

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
- Open example
- Hide Calendar using button
You can change bulma-calendar version to 6.1.0 in package.json and the problem disappears
You are welcome to look at it, but simply copying the old 6.1.0 passage will not do the trick.
The problem is that the original DOM element is modified by the calendar and would have to be restored to its old state in a destroy(). Previously the "destroyed" element was left in an undefined state, now it is deleted from the DOM on a destroy(). Therefore, a new attach() does not work, because the element no longer exists.
What's wrong with showing and hiding the element with a simple show() / hide()? These functions are made for that.