Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Fetch the activity list after patching the task instead of relying on watchEffect

Tianzhou Chen440a49aca9e7
diff --git a/frontend/src/store/modules/task.ts b/frontend/src/store/modules/task.ts
index 29b6c9351c..ec021e5ef8 100644
--- a/frontend/src/store/modules/task.ts
+++ b/frontend/src/store/modules/task.ts
@@ -55,7 +55,7 @@ const actions = {
},
async patchTask(
- { commit }: any,
+ { commit, dispatch }: any,
{
taskId,
taskPatch,
@@ -78,6 +78,8 @@ const actions = {
task: updatedTask,
});
+ dispatch("activity/fetchActivityListForTask", taskId, { root: true });
+
return updatedTask;
},
};
diff --git a/frontend/src/views/TaskActivityPanel.vue b/frontend/src/views/TaskActivityPanel.vue
index b03a94471a..f0b68f348f 100644
--- a/frontend/src/views/TaskActivityPanel.vue
+++ b/frontend/src/views/TaskActivityPanel.vue
@@ -43,12 +43,7 @@
</div>
</div>
</template>
- <template
- v-else-if="
- activity.attributes.actionType ==
- 'bytebase.task.comment.create'
- "
- >
+ <template v-else>
<div class="relative">
<BBAvatar
class="rounded-full ring-8 ring-white"
@@ -291,7 +286,6 @@ import {
nextTick,
ref,
reactive,
- watchEffect,
PropType,
} from "vue";
import { useStore } from "vuex";
@@ -361,6 +355,10 @@ export default {
});
};
+ // Only call upon setup, followup fetch will be done only when necessary
+ // e.g. after patching the task in the task store.
+ prepareActivityList();
+
const activityList = computed(() =>
store.getters["activity/activityListByTask"](props.task.id)
);
@@ -425,8 +423,6 @@ export default {
});
};
- watchEffect(prepareActivityList);
-
const actionSentence = (actionType: TaskActionType) => {
switch (actionType) {
case "bytebase.task.create":