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

Improve cells performance #584

Merged
merged 2 commits into from
Aug 23, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
// which can leads to a lot of garbage collections
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*since it leads to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. You are welcome.

// when displaying many cells
return columnWidth ? `width: ${htmlSafe(columnWidth)};` : '';
}),

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