diff --git a/src/services/service.ts b/src/services/service.ts index 851eb9a..9ea0b69 100755 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -1117,10 +1117,18 @@ export default class Services { for (const [processId, process] of Object.entries(newProcesses)) { const existing = await this.getProcess(processId); if (existing) { - const event = new CustomEvent('process-updated', { - detail: { processId } - }); - window.dispatchEvent(event); + const lastKnownCommitment = this.getLastCommitedState(existing); + const newLastCommitment = this.getLastCommitedState(process); + if (!lastKnownCommitment || !newLastCommitment) { continue } + if (lastKnownCommitment.commited_in !== newLastCommitment.commited_in) { + console.log('Dispatching process-updated event'); + const event = new CustomEvent('process-updated', { + detail: { processId } + }); + window.dispatchEvent(event); + } + + // Otherwise we're probably just in the initial loading at page initialization // We may learn an update for this process // TODO maybe actually check if what the relay is sending us contains more information than what we have