Commit de2992fc authored by Mike Greiling's avatar Mike Greiling

Merge branch 'tz-load-mr-popovers-conditional' into 'master'

Made MR Popovers bundle load conditionally

See merge request gitlab-org/gitlab!42024
parents 0d160c83 cfe3a498
...@@ -5,7 +5,6 @@ import renderMermaid from './render_mermaid'; ...@@ -5,7 +5,6 @@ import renderMermaid from './render_mermaid';
import renderMetrics from './render_metrics'; import renderMetrics from './render_metrics';
import highlightCurrentUser from './highlight_current_user'; import highlightCurrentUser from './highlight_current_user';
import initUserPopovers from '../../user_popovers'; import initUserPopovers from '../../user_popovers';
import initMRPopovers from '../../mr_popover';
// Render GitLab flavoured Markdown // Render GitLab flavoured Markdown
// //
...@@ -17,9 +16,25 @@ $.fn.renderGFM = function renderGFM() { ...@@ -17,9 +16,25 @@ $.fn.renderGFM = function renderGFM() {
renderMermaid(this.find('.js-render-mermaid')); renderMermaid(this.find('.js-render-mermaid'));
highlightCurrentUser(this.find('.gfm-project_member').get()); highlightCurrentUser(this.find('.gfm-project_member').get());
initUserPopovers(this.find('.js-user-link').get()); initUserPopovers(this.find('.js-user-link').get());
initMRPopovers(this.find('.gfm-merge_request').get());
const mrPopoverElements = this.find('.gfm-merge_request').get();
if (mrPopoverElements.length) {
import(/* webpackChunkName: 'MrPopoverBundle' */ '../../mr_popover')
.then(({ default: initMRPopovers }) => {
initMRPopovers(mrPopoverElements);
})
.catch(() => {});
}
renderMetrics(this.find('.js-render-metrics').get()); renderMetrics(this.find('.js-render-metrics').get());
return this; return this;
}; };
$(() => $('body').renderGFM()); $(() => {
window.requestIdleCallback(
() => {
$('body').renderGFM();
},
{ timeout: 500 },
);
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment