Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError after calendar Destroy - this._ui is null Error v6.1.18 #315

Open
3 tasks done
Krzyshio opened this issue Feb 13, 2023 · 1 comment
Open
3 tasks done

TypeError after calendar Destroy - this._ui is null Error v6.1.18 #315

Krzyshio opened this issue Feb 13, 2023 · 1 comment

Comments

@Krzyshio
Copy link

Your issue may already be reported!
Please search on the issue track before creating one.

  • Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
  • Are you running the latest version?
  • 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

image

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

Codesandbox with example

You can change bulma-calendar version to 6.1.0 in package.json and the problem disappears

@michael-hack
Copy link
Owner

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.

dmoebius added a commit to meta-system-GmbH/bulma-calendar that referenced this issue Aug 17, 2023
…k#315)

The fix removes the global onDocumentClickDateTimePicker event handler on destroy.
Plus: the destroy() method has been made public in the typescript definition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants