diff options
-rw-r--r-- | app/assets/javascripts/lib/utils/datetime_utility.js | 4 | ||||
-rw-r--r-- | changelogs/unreleased/timeago-perf-fix.yml | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/assets/javascripts/lib/utils/datetime_utility.js b/app/assets/javascripts/lib/utils/datetime_utility.js index 963d2851e5f..e8e502694d6 100644 --- a/app/assets/javascripts/lib/utils/datetime_utility.js +++ b/app/assets/javascripts/lib/utils/datetime_utility.js @@ -29,7 +29,7 @@ setTimeago = true; } - $timeagoEls.each(function() { + $timeagoEls.filter(':not([data-timeago-rendered])').each(function() { var $el = $(this); $el.attr('title', gl.utils.formatDate($el.attr('datetime'))); @@ -39,6 +39,8 @@ template: '<div class="tooltip local-timeago" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' }); } + + $el.attr('data-timeago-rendered', true); gl.utils.renderTimeago($el); }); }; diff --git a/changelogs/unreleased/timeago-perf-fix.yml b/changelogs/unreleased/timeago-perf-fix.yml new file mode 100644 index 00000000000..265e7db29a9 --- /dev/null +++ b/changelogs/unreleased/timeago-perf-fix.yml @@ -0,0 +1,4 @@ +--- +title: Fixed timeago re-rendering every timeago +merge_request: +author: |