Commit cb2fe659 authored by Filipa Lacerda's avatar Filipa Lacerda

Port scroll to bottom methods to new component

parent 5747d40e
...@@ -11,11 +11,35 @@ export default { ...@@ -11,11 +11,35 @@ export default {
computed: { computed: {
...mapState(['traceEndpoint', 'trace', 'isTraceComplete']), ...mapState(['traceEndpoint', 'trace', 'isTraceComplete']),
}, },
updated() {
this.$nextTick(() => {
this.handleScrollDown();
});
},
mounted() {
this.$nextTick(() => {
this.handleScrollDown();
});
},
methods: { methods: {
...mapActions(['toggleCollapsibleLine']), ...mapActions(['toggleCollapsibleLine', 'scrollBottom']),
handleOnClickCollapsibleLine(section) { handleOnClickCollapsibleLine(section) {
this.toggleCollapsibleLine(section); this.toggleCollapsibleLine(section);
}, },
/**
* The job log is sent in HTML, which means we need to use `v-html` to render it
* Using the updated hook with $nextTick is not enough to wait for the DOM to be updated
* in this case because it runs before `v-html` has finished running, since there's no
* Vue binding.
* In order to scroll the page down after `v-html` has finished, we need to use setTimeout
*/
handleScrollDown() {
if (this.isScrolledToBottomBeforeReceivingTrace) {
setTimeout(() => {
this.scrollBottom();
}, 0);
}
},
}, },
}; };
</script> </script>
......
---
title: Fix scroll to bottom with new job log
merge_request:
author:
type: fixed
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