Skip to content

Commit 02351a0

Browse files
committed
Updating watcher for saga_id
1 parent ad9444f commit 02351a0

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Frontend/src/components/messages2/SagaDiagram.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ import SagaCompletedNode from "./SagaDiagram/SagaCompletedNode.vue";
1818
const sagaDiagramStore = useSagaDiagramStore();
1919
const { showMessageData } = storeToRefs(sagaDiagramStore);
2020
21-
const store = useMessageStore();
22-
const { state: messageState } = storeToRefs(store);
21+
const messageStore = useMessageStore();
2322
2423
//Watch for message and set saga ID when component mounts or message changes
2524
watch(
26-
() => messageState.value.data.invoked_saga,
27-
(newSagas) => {
28-
if (newSagas.has_saga) {
29-
sagaDiagramStore.setSagaId(newSagas.saga_id || "");
30-
} else {
31-
sagaDiagramStore.clearSagaHistory();
25+
() => messageStore.state,
26+
(newState) => {
27+
if (newState.data.invoked_saga.saga_id !== sagaDiagramStore.sagaId) {
28+
sagaDiagramStore.setSagaId(newState.data.invoked_saga.saga_id || "");
3229
}
3330
},
3431
{ immediate: true }
@@ -42,7 +39,7 @@ const vm = computed<SagaViewModel>(() => {
4239
const completedUpdate = sagaDiagramStore.sagaHistory?.changes.find((update) => update.status === "completed");
4340
const completionTime = completedUpdate ? new Date(completedUpdate.finish_time) : null;
4441
45-
const { data } = messageState.value;
42+
const { data } = messageStore.state;
4643
const { invoked_saga: saga } = data;
4744
const sagaHistory = sagaDiagramStore.sagaHistory;
4845

0 commit comments

Comments
 (0)