Commit d8e6347d authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'tz-fix-issue-detail-rerender' into 'master'

Fixes rerendering of the issue page when description loaded

See merge request gitlab-org/gitlab!41006
parents e3d3f0fe 0f0818d0
...@@ -48,11 +48,16 @@ export default { ...@@ -48,11 +48,16 @@ export default {
return { return {
preAnimation: false, preAnimation: false,
pulseAnimation: false, pulseAnimation: false,
initialUpdate: true,
}; };
}, },
watch: { watch: {
descriptionHtml() { descriptionHtml(newDescription, oldDescription) {
if (!this.initialUpdate && newDescription !== oldDescription) {
this.animateChange(); this.animateChange();
} else {
this.initialUpdate = false;
}
this.$nextTick(() => { this.$nextTick(() => {
this.renderGFM(); this.renderGFM();
......
...@@ -20,20 +20,25 @@ export default { ...@@ -20,20 +20,25 @@ export default {
}, },
computed: { computed: {
pinnedLinks() { pinnedLinks() {
return [ const links = [];
{ if (this.publishedIncidentUrl) {
links.push({
id: 'publishedIncidentUrl', id: 'publishedIncidentUrl',
url: this.publishedIncidentUrl, url: this.publishedIncidentUrl,
text: STATUS_PAGE_PUBLISHED, text: STATUS_PAGE_PUBLISHED,
icon: 'tanuki', icon: 'tanuki',
}, });
{ }
if (this.zoomMeetingUrl) {
links.push({
id: 'zoomMeetingUrl', id: 'zoomMeetingUrl',
url: this.zoomMeetingUrl, url: this.zoomMeetingUrl,
text: JOIN_ZOOM_MEETING, text: JOIN_ZOOM_MEETING,
icon: 'brand-zoom', icon: 'brand-zoom',
}, });
]; }
return links;
}, },
}, },
methods: { methods: {
...@@ -45,7 +50,7 @@ export default { ...@@ -45,7 +50,7 @@ export default {
</script> </script>
<template> <template>
<div class="gl-display-flex gl-justify-content-start"> <div v-if="pinnedLinks && pinnedLinks.length" class="gl-display-flex gl-justify-content-start">
<template v-for="(link, i) in pinnedLinks"> <template v-for="(link, i) in pinnedLinks">
<div v-if="link.url" :key="link.id" :class="{ 'gl-pr-3': needsPaddingClass(i) }"> <div v-if="link.url" :key="link.id" :class="{ 'gl-pr-3': needsPaddingClass(i) }">
<gl-button <gl-button
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
-# haml-lint:disable InlineJavaScript -# haml-lint:disable InlineJavaScript
%script#js-issuable-app-initial-data{ type: "application/json" }= issuable_initial_data(@issue).to_json %script#js-issuable-app-initial-data{ type: "application/json" }= issuable_initial_data(@issue).to_json
#js-issuable-app #js-issuable-app
.title-container
%h2.title= markdown_field(@issue, :title) %h2.title= markdown_field(@issue, :title)
- if @issue.description.present? - if @issue.description.present?
.description{ class: can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '' } .description{ class: can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '' }
......
...@@ -36,11 +36,26 @@ describe('Description component', () => { ...@@ -36,11 +36,26 @@ describe('Description component', () => {
$('.issuable-meta .flash-container').remove(); $('.issuable-meta .flash-container').remove();
}); });
it('animates description changes', () => { it('doesnt animate first description changes', () => {
vm.descriptionHtml = 'changed'; vm.descriptionHtml = 'changed';
return vm.$nextTick().then(() => {
expect(
vm.$el.querySelector('.md').classList.contains('issue-realtime-pre-pulse'),
).toBeFalsy();
jest.runAllTimers();
return vm.$nextTick();
});
});
it('animates description changes on live update', () => {
vm.descriptionHtml = 'changed';
return vm return vm
.$nextTick() .$nextTick()
.then(() => {
vm.descriptionHtml = 'changed second time';
return vm.$nextTick();
})
.then(() => { .then(() => {
expect( expect(
vm.$el.querySelector('.md').classList.contains('issue-realtime-pre-pulse'), vm.$el.querySelector('.md').classList.contains('issue-realtime-pre-pulse'),
......
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