Commit 421848db authored by Natalia Tepluhina's avatar Natalia Tepluhina Committed by Enrique Alcántara

Stop reusing design component on route change

- Fixed router spec
parent 11de0b1b
...@@ -156,6 +156,9 @@ export default { ...@@ -156,6 +156,9 @@ export default {
}, },
mounted() { mounted() {
Mousetrap.bind('esc', this.closeDesign); Mousetrap.bind('esc', this.closeDesign);
this.trackEvent();
// We need to reset the active discussion when opening a new design
this.updateActiveDiscussion();
}, },
beforeDestroy() { beforeDestroy() {
Mousetrap.unbind('esc', this.closeDesign); Mousetrap.unbind('esc', this.closeDesign);
...@@ -279,23 +282,6 @@ export default { ...@@ -279,23 +282,6 @@ export default {
}); });
}, },
}, },
beforeRouteEnter(to, from, next) {
next(vm => {
vm.trackEvent();
});
},
beforeRouteUpdate(to, from, next) {
this.trackEvent();
this.closeCommentForm();
// We need to reset the active discussion when opening a new design
this.updateActiveDiscussion();
next();
},
beforeRouteLeave(to, from, next) {
// We need to reset the active discussion when moving to design list view
this.updateActiveDiscussion();
next();
},
createImageDiffNoteMutation, createImageDiffNoteMutation,
DESIGNS_ROUTE_NAME, DESIGNS_ROUTE_NAME,
}; };
......
...@@ -318,6 +318,6 @@ export default { ...@@ -318,6 +318,6 @@ export default {
</li> </li>
</ol> </ol>
</div> </div>
<router-view /> <router-view :key="$route.fullPath" />
</div> </div>
</template> </template>
...@@ -33,6 +33,7 @@ function factory(routeArg) { ...@@ -33,6 +33,7 @@ function factory(routeArg) {
design: { loading: true }, design: { loading: true },
permissions: { loading: true }, permissions: { loading: true },
}, },
mutate: jest.fn(),
}, },
}, },
}); });
......
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