Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Destroy method should wipe out entire Litepicker object? #289

Open
bewards opened this issue Jan 18, 2022 · 0 comments
Open

Destroy method should wipe out entire Litepicker object? #289

bewards opened this issue Jan 18, 2022 · 0 comments

Comments

@bewards
Copy link

bewards commented Jan 18, 2022

Using the Litepicker within a Svelte project, I have the Litepicker element nested within a modal that is bound to a "selected product". When a "selected product" object is not selected, the modal disappears and is wiped from the DOM. Once a "selected product" is activated and the modal re-appears, the Litepicker no longer opens. I am able to fix this by destroying the Litepicker and adding a null check condition to re-initialize it, but I also have to set the litepicker object to null because the destroy method only wipes out the protected member ui. Since I don't have access to this ui property in TypeScript, I have to manually set my instance of Litepicker to null as well for that check to work and for it to re-initialize. Out of curiosity, is there a reason the destroy method doesn't wipe out the entire instance?

This is a low hanging fruit question and not so much a bug, but I was expecting the destroy method to wipe out the instance so that garbage collection does it's thing and the litepicker instance is no longer defined.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant