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(resizer): autosizeColumns is called too many times on page load #1343

Merged
merged 3 commits into from
Jan 18, 2024

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Jan 18, 2024

  • when loading a new grid, we are calling grid.autosizeColumns() to resize the columns and while adding tests for that method I incidently discovered that it was being called multiple times on a page load (up to 6-8x times) but in reality there is no need to call it more than once or twice.
  • there is also no need to call the autosizeColumns if the grid dimension calculated by the Resizer Service are the same as the previously calculated dimensions
  • the updated code will never call autosizeColumns more than twice on a page load, however note that the method will always be called whenever the grid dimensions or columns get updated

- when loading a new grid, we are calling `grid.autosizeColumns()` to resize the columns and while adding tests for that method I incidently discovered that it was being called multiple times on a page load (up to 6-8x times) but in reality there is no need to call it more than once or twice.
- there is also no need to call the `autosizeColumns` if the grid dimension calculated by the Resizer Service are the same as the previously calculated dimensions
- the updated code will never call `autosizeColumns` more than twice on a page load
Copy link

codecov bot commented Jan 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (03cad4a) 99.4% compared to head (ade8ebe) 99.4%.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1343     +/-   ##
========================================
+ Coverage    99.4%   99.4%   +0.1%     
========================================
  Files         198     198             
  Lines       21284   21291      +7     
  Branches     7099    7101      +2     
========================================
+ Hits        21144   21151      +7     
  Misses        140     140             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ghiscoding ghiscoding changed the title perf(resizer): don't call autosizeColumns too many times perf(resizer): autosizeColumns is called too many times Jan 18, 2024
@ghiscoding ghiscoding changed the title perf(resizer): autosizeColumns is called too many times perf(resizer): autosizeColumns is called too many times on page load Jan 18, 2024
@ghiscoding ghiscoding merged commit e02ac55 into master Jan 18, 2024
5 checks passed
@ghiscoding ghiscoding deleted the perf/multiple-autosize-cols branch January 18, 2024 18:00
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

Successfully merging this pull request may close these issues.

1 participant