diff --git a/change/@acedatacloud-hub-ac3139e6-58a5-4d6b-a475-d461d6e72083.json b/change/@acedatacloud-hub-ac3139e6-58a5-4d6b-a475-d461d6e72083.json
new file mode 100644
index 00000000..ba7254d5
--- /dev/null
+++ b/change/@acedatacloud-hub-ac3139e6-58a5-4d6b-a475-d461d6e72083.json
@@ -0,0 +1,7 @@
+{
+ "type": "patch",
+ "comment": "fix bugs of not refreshing for mj",
+ "packageName": "@acedatacloud/hub",
+ "email": "germey@acedata.cloud",
+ "dependentChangeType": "patch"
+}
diff --git a/src/components/midjourney/tasks/TaskBriefList.vue b/src/components/midjourney/tasks/TaskBriefList.vue
index c06535c2..68cac919 100644
--- a/src/components/midjourney/tasks/TaskBriefList.vue
+++ b/src/components/midjourney/tasks/TaskBriefList.vue
@@ -38,7 +38,7 @@ export default defineComponent({
ElSkeleton,
ElSkeletonItem
},
- emits: ['update:modelValue', 'custom'],
+ emits: ['update:modelValue', 'custom', 'refresh'],
data() {
return {
job: 0
@@ -55,6 +55,16 @@ export default defineComponent({
return this.$store.state.midjourney.application;
}
},
+ watch: {
+ tasks: {
+ handler(val, oldVal) {
+ if (val && oldVal && JSON.stringify(val) !== JSON.stringify(oldVal)) {
+ this.$emit('refresh', val);
+ }
+ },
+ deep: true
+ }
+ },
async mounted() {
await this.$store.dispatch('midjourney/setImagineTasks', undefined);
this.getImagineTasks();
diff --git a/src/components/midjourney/tasks/TaskFullList.vue b/src/components/midjourney/tasks/TaskFullList.vue
index a9a86462..2eb93f5a 100644
--- a/src/components/midjourney/tasks/TaskFullList.vue
+++ b/src/components/midjourney/tasks/TaskFullList.vue
@@ -39,7 +39,7 @@ export default defineComponent({
ElSkeletonItem,
ElCard
},
- emits: ['update:modelValue', 'custom'],
+ emits: ['update:modelValue', 'custom', 'refresh'],
data(): IData {
return {
job: undefined
@@ -74,6 +74,14 @@ export default defineComponent({
await this.$store.dispatch('midjourney/setImagineTasks', undefined);
this.getImagineTasks();
}
+ },
+ tasks: {
+ handler(val, oldVal) {
+ if (val && oldVal && JSON.stringify(val) !== JSON.stringify(oldVal)) {
+ this.$emit('refresh', val);
+ }
+ },
+ deep: true
}
},
async mounted() {
diff --git a/src/pages/midjourney/History.vue b/src/pages/midjourney/History.vue
index e6874999..4949b05f 100644
--- a/src/pages/midjourney/History.vue
+++ b/src/pages/midjourney/History.vue
@@ -7,9 +7,9 @@
:need-apply="needApply"
class="mb-4"
:service="service"
- @refresh="onGetApplications"
+ @refresh="onGetApplication"
/>
-
+
{{ $t('midjourney.button.generateNew') }}
@@ -71,7 +71,7 @@ export default defineComponent({
}
},
async mounted() {
- await this.onGetApplications();
+ await this.onGetApplication();
},
methods: {
async onGenerateNew() {
@@ -79,7 +79,7 @@ export default defineComponent({
name: ROUTE_MIDJOURNEY_INDEX
});
},
- async onGetApplications() {
+ async onGetApplication() {
await this.$store.dispatch('midjourney/getApplication');
},
async onStartTask(request: IMidjourneyImagineRequest) {
diff --git a/src/pages/midjourney/Index.vue b/src/pages/midjourney/Index.vue
index 6ef8f54c..24b398be 100644
--- a/src/pages/midjourney/Index.vue
+++ b/src/pages/midjourney/Index.vue
@@ -25,7 +25,7 @@
-
+