Commit c95ec812 authored by Phil Hughes's avatar Phil Hughes

Re-compile merge request Vue app after jQuery ajax

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/27134
parent e5eebeb8
...@@ -150,6 +150,11 @@ require('./smart_interval'); ...@@ -150,6 +150,11 @@ require('./smart_interval');
$('.mr-widget-body').replaceWith($html.find('.mr-widget-body')); $('.mr-widget-body').replaceWith($html.find('.mr-widget-body'));
$('.mr-widget-footer').replaceWith($html.find('.mr-widget-footer')); $('.mr-widget-footer').replaceWith($html.find('.mr-widget-footer'));
$('.approvals-components').replaceWith($html.find('.approvals-components'));
if (gl.compileApprovalsWidget) {
gl.compileApprovalsWidget();
}
}); });
}; };
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
.on('click', '.js-rebase-button', () => { .on('click', '.js-rebase-button', () => {
$('.js-rebase-button').html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress"); $('.js-rebase-button').html("<i class='fa fa-spinner fa-spin'></i> Rebase in progress");
}); });
} else if (!$('.mr-approvals-footer').length) { } else {
// getMergeStatus replaces the MR widget with new, updated HTML, which means any persistent // getMergeStatus replaces the MR widget with new, updated HTML, which means any persistent
// event management gets clobbered. When the MR is approvable, MR status is already managed // event management gets clobbered. When the MR is approvable, MR status is already managed
// and breaks when the DOM is clobbered. // and breaks when the DOM is clobbered.
......
...@@ -6,11 +6,22 @@ require('./approvals/approvals_bundle'); ...@@ -6,11 +6,22 @@ require('./approvals/approvals_bundle');
window.gl = window.gl || {}; window.gl = window.gl || {};
$(() => { $(() => {
const rootEl = document.getElementById('merge-request-widget-app'); let widgetSharedStore;
const widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl);
gl.MergeRequestWidgetApp = new Vue({ gl.compileApprovalsWidget = () => {
el: rootEl, const rootEl = document.getElementById('merge-request-widget-app');
data: widgetSharedStore.data,
}); if (gl.MergeRequestWidgetApp) {
gl.MergeRequestWidgetApp.$destroy();
} else {
widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl);
}
gl.MergeRequestWidgetApp = new Vue({
el: rootEl,
data: widgetSharedStore.data,
});
};
gl.compileApprovalsWidget();
}); });
---
title: Fixed merge request state not updating when approvals feature is active
merge_request:
author:
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