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

perf(sbb-datepicker): dateParser gets called too many times #1915

Closed
jeripeierSBB opened this issue Aug 3, 2023 · 2 comments · Fixed by #2889
Closed

perf(sbb-datepicker): dateParser gets called too many times #1915

jeripeierSBB opened this issue Aug 3, 2023 · 2 comments · Fixed by #2889
Assignees

Comments

@jeripeierSBB
Copy link
Contributor

jeripeierSBB commented Aug 3, 2023

If you select a date in calendar, the dateParser function gets called 4 times. We can improve it to call it fewer times.

@MarioCastigliano
Copy link
Contributor

The reason for this is that all satellite components (sbb-datepicker-next-day, sbb-datepicker-previous-day...) listen to the change event to check if any state needs to be updated (e.g. disable arrows). To solve this problem there are two possible approaches:

  • store the valueAsDate inside the datepicker class, so that the parseParser function doesn't get called with every getValueAsDate.
  • populate the change event detail with a valueAsDate field, so that satellite components don't need to use getValueAsDate at all.

Given the low priority and the imperceptible impact on performance, we decided to wait for @kyubisation to discuss this and choose a solution that is in line with the project's common practices.

@kyubisation
Copy link
Contributor

I'm tempted to postpone this until our framework migration, with which valueAsDate can be directly used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants