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';
import renderMetrics from './render_metrics';
import highlightCurrentUser from './highlight_current_user';
import initUserPopovers from '../../user_popovers';
import initMRPopovers from '../../mr_popover';
// Render GitLab flavoured Markdown
//
......@@ -17,9 +16,25 @@ $.fn.renderGFM = function renderGFM() {
renderMermaid(this.find('.js-render-mermaid'));
highlightCurrentUser(this.find('.gfm-project_member').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());
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