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: skip reapplying empty html when target is already empty #1230

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Nov 28, 2023

  • when calling applyHtmlCode() method and our target element is empty and we try to reapply empty, it should always be ok to simply skip this reassignment.
  • this should also help with performance since trying to reapply empty using innerHTML will probably cause a canvas repaint but if we manage to skip this then a repaint will also be skipped
  • this should also help with CSP too because we could write a Formatter with native element while still returning empty string when there's no value to return, that will then call applyHtmlCode and skip the assignment since the cell was already detected as empty

- when calling `applyHtmlCode()` method and our target element is empty and we try to reapply empty, it should always be ok to simply skip this reassignment.
- this should also help with performance since trying to reapply empty using `innerHTML` will probably cause a canvas repaint but if we manage to skip this then a repaint will also be skipped
- this should also help with CSP because we could write a Formatter with native element while still returning empty string when there's no value to return, that will then call `applyHtmlCode` and skip the assignment if the cell is already empty
Copy link

codecov bot commented Nov 28, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (5cb4dd5) 86.11% compared to head (797d379) 86.10%.

Files Patch % Lines
packages/common/src/core/slickGrid.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1230      +/-   ##
==========================================
- Coverage   86.11%   86.10%   -0.00%     
==========================================
  Files         197      197              
  Lines       21245    21248       +3     
  Branches     7066     7067       +1     
==========================================
+ Hits        18292    18294       +2     
- Misses       2953     2954       +1     

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

@ghiscoding ghiscoding merged commit ba99fae into next Nov 28, 2023
5 checks passed
@ghiscoding ghiscoding deleted the chore/skip-reapplying-empty-assignment branch November 28, 2023 23:01
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.

2 participants