Skip to content

Commit

Permalink
Improve cells performance (#584)
Browse files Browse the repository at this point in the history
* Improve cells performance

* fixup! Improve cells performance
  • Loading branch information
mostafa-sakhiri authored and alexander-alvarez committed Aug 23, 2018
1 parent e6e1e3e commit 3350fe8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions addon/components/cells/base.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Component from '@ember/component';
import { computed } from '@ember/object';
import layout from 'ember-light-table/templates/components/cells/base';
import cssStyleify from 'ember-light-table/utils/css-styleify';
import { htmlSafe } from '@ember/string';

/**
* @module Light Table
Expand All @@ -26,12 +26,16 @@ const Cell = Component.extend({

style: computed('enableScaffolding', 'column.width', function() {
let column = this.get('column');
let columnWidth = column.get('width');

if (this.get('enableScaffolding') || !column) {
return '';
}

return cssStyleify(column.getProperties(['width']));
// For performance reasons, it's more interesting to bypass cssStyleify
// since it leads to a lot of garbage collections
// when displaying many cells
return columnWidth ? `width: ${htmlSafe(columnWidth)};` : '';
}),

align: computed('column.align', function() {
Expand Down

0 comments on commit 3350fe8

Please sign in to comment.