Skip to content

Commit a626958

Browse files
committed
Making show message data lazy load again
1 parent 60d12b9 commit a626958

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Frontend/src/stores/SagaDiagramStore.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,22 @@ export const useSagaDiagramStore = defineStore("SagaDiagramStore", () => {
2323
const messagesData = ref<SagaMessageData[]>([]);
2424
const MessageBodyEndpoint = "messages/{0}/body";
2525

26-
// Watch the sagaId and trigger fetches when it changes
26+
// Watch the sagaId and fetch saga history when it changes
2727
watch(sagaId, async (newSagaId) => {
2828
if (newSagaId) {
2929
await fetchSagaHistory(newSagaId);
30-
31-
// If saga history was successfully fetched, fetch message data
32-
if (sagaHistory.value) {
33-
await fetchMessagesData(sagaHistory.value);
34-
}
3530
} else {
3631
clearSagaHistory();
3732
}
3833
});
3934

35+
// Watch both showMessageData and sagaHistory together
36+
watch([showMessageData, sagaHistory], async ([show, history]) => {
37+
if (show && history) {
38+
await fetchMessagesData(history);
39+
}
40+
});
41+
4042
function setSagaId(id: string | null) {
4143
sagaId.value = id;
4244
}

0 commit comments

Comments
 (0)