Performance : Prevent DOM reflow on import preview
See original GitHub issueCurrently, when the import preview is huge (i.e. thousands of rows), it forces the browser to do substantial DOM reflow. This greatly slows down the browser as it tries to resize the preview table (and the whole page) over and over again as it prints new DOM elements.
To improve performance, you can set table.import-preview
’s display
to none
first, and then set it to table
later on after the whole table has been loaded.
That is, add this before the table is loaded
<style>
table.import-preview {
display:none;
}
</style>
(or add this in import.css
), and then add at the end of import_export/import.html
<script type="text/javascript">
(function() {
var import_previews = document.querySelectorAll('table.import-preview')
for (var i = 0; i < import_previews.length; i++) {
import_previews[i].style.display = 'table'
}
})();
</script>
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Web Performance: Minimising DOM Reflow / Layout Shift
In this article, I will be listing a few ways by which a DOM reflow / layout shift event might occur, why it's...
Read more >10 Ways to Minimize Reflows and Improve Performance
Adding, removing or changing visible DOM elements. The first is obvious; using JavaScript to change the DOM will cause a reflow.
Read more >Methods Of Improving And Optimizing Performance In React ...
Analyzing React Components With Chrome's Performance Tab # · Disable all extensions temporarily, especially React Developer Tools, because they ...
Read more >Lightning Components Performance Best Practices
In this blog post, we discuss how these characteristics impact performance, and review a list of best practices to optimize the performance ......
Read more >Make Webpages Load Faster with Lazy Loading - Infinum
Avoiding Content Reflow ... When an image is yet to be downloaded, the browser doesn't know the size it will take up. Then...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@bmihelac i’ll try that out and will let you know how it goes 😃 thanks !
@andrewgy8 the down side is if javascript is disabled, then the preview will never show up 😃