Found a bug when pickr is destroyed before initialization is complete #233
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm now using this library to create a CAD app using Electron. I really appreciate this library due to its easiness to be config'ed. But since my app uses more requestAnimationFrame, FPS kind of become important here.
I found that the constructor is coded using
requestAnimationFrame
, maybe this is due to get the Pickr offsetWidth. But, if somehow the element was not rendered by the javascript EventLoop and Picker element isdestroyAndRemove()
for some reason, the constructor will get stuck in an infinite loop of arequestAnimationFrame
.Here is how to reproduce. Open devtools console, then type:
and record the performance profile from chrome dev-tools. You will see a lot of useless 100us
requestAnimationFrame
call tree.My solution, give the flag
_destroyed
and set it to true whendestroy()
called.