-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
Improve performance when there are many pickers. #125
Conversation
If you have many pickers, the rendering time will be significantly slower. To solve this, this commit provides a solution for this.
I don't see how this makes a difference with rendering/startup time... an Alpine component will only be initialised once anyway. Moving the property to a piece of data wouldn't make a difference since it's still only being instantiated once, right? |
You're completely right in your opinion when you only have one or two flatpickrs per page. There is nothing wrong. But, Imagin' you have a huge bunch of pickers on a page. Let's say 100 or 150. The reason for this is a super-big admin screen with a table consisting of a lot of date fields. In that case, it makes a huge difference, when the component is initialized. It will be initialized for every single picker you add to your page. While loading the page, the flatpickr will be appended to the end of the body tag. you will save a lot of loading and render time when you do the initialization of flatpickr only if the user really needs it. |
Ah, sorry you're right. Your only initialising the picker on click, instead of automatically. |
No probs |
dear @ryangjchandler, when do you think, we can merge and close this PR? |
I'll need to give this a test before merging, will do that shortly. |
switched to |
@comes I've made some changes to the code in this PR so that it's slightly more readable and maintainable, would you be able to give it all a go again to make sure it still works as expected. I've tested myself and can't see any problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely agree with this refactoring.
This has been released in v0.3.4. |
If you have many pickers, the rendering time will be significantly slower. To solve this, this commit provides a solution for this.
the trick is, just create a flatpickr instance, if you need one.