Skip to content

Commit

Permalink
Speed up rendering of large docs in doc table
Browse files Browse the repository at this point in the history
Back in 2014 a utility was added to insert <wbr> (word break opportunity)
tags into doc table fields to improve their display in the browser. This
utility looped over every character in _source when it was selected as a
column in the doc table, which it was be default. That really started to
slow things down when displaying large docs. I compared how the browser
renders things with and without the <wbr>'s and there's almost no
difference, certainly nothing as dramatic as shown in the linked PR
which added this word breaking functionality. Perhaps browsers have
improved in the last two years, or perhaps something changed in our CSS.
Since we're getting no or negligible value from this utility and it
makes Discover impossible to use with large docs, I simply removed it.

Fixes elastic#6328
Related elastic#1993
  • Loading branch information
Bargs committed Nov 9, 2016
1 parent b38a106 commit fc443bb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 84 deletions.
15 changes: 5 additions & 10 deletions src/ui/public/doc_table/components/table_row.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import _ from 'lodash';
import $ from 'jquery';
import addWordBreaks from 'ui/utils/add_word_breaks';
import 'ui/highlight';
import 'ui/highlight/highlight_tags';
import 'ui/doc_viewer';
Expand Down Expand Up @@ -150,18 +149,14 @@ module.directive('kbnTableRow', function ($compile) {
/**
* Fill an element with the value of a field
*/
function _displayField(row, fieldName, breakWords) {
function _displayField(row, fieldName, truncate) {
let indexPattern = $scope.indexPattern;
let text = indexPattern.formatField(row, fieldName);

if (breakWords) {
text = addWordBreaks(text, MIN_LINE_LENGTH);

if (text.length > MIN_LINE_LENGTH) {
return truncateByHeightTemplate({
body: text
});
}
if (truncate && text.length > MIN_LINE_LENGTH) {
return truncateByHeightTemplate({
body: text
});
}

return text;
Expand Down
25 changes: 0 additions & 25 deletions src/ui/public/utils/__tests__/add_word_breaks.js

This file was deleted.

49 changes: 0 additions & 49 deletions src/ui/public/utils/add_word_breaks.js

This file was deleted.

0 comments on commit fc443bb

Please sign in to comment.