Fix suno task experience (#86)

Co-authored-by: Germey <germey@acedata.cloud>
This commit is contained in:
GermeyandGermey authored and GitHub committed 2024-07-27 19:09:58 +00:00
1 parent e6c273cbf4
commit 7110baf4a3
4 files changed
+27 -6

No files matched your search

+18 -3
View File
@@ -79,6 +79,21 @@ export default defineComponent({
},
application() {
return this.$store.state.suno.application;
},
tasks() {
return this.$store.state.suno.tasks;
}
},
watch: {
tasks: {
handler(value, oldValue) {
// scroll down if new tasks are added
if (value?.items?.length > oldValue?.items?.length) {
console.debug('new tasks detected');
this.onScrollDown();
}
},
deep: true
}
},
async mounted() {
@@ -125,12 +140,12 @@ export default defineComponent({
},
async onScrollDown() {
setTimeout(() => {
// scroll to bottom for `.tasks`
const el = document.querySelector('.tasks');
// scroll to bottom for `.recent`
const el = document.querySelector('.recent');
if (el) {
el.scrollTop = el.scrollHeight;
}
}, 500);
}, 1000);
},
async onGetTasks() {
if (this.loading) {