From b6c2d211e516dd1d3b68fcd81cd3b2ab67bdc609 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Mon, 3 Mar 2025 23:24:41 +0100 Subject: [PATCH] Update more aggressively processes on relay notifications --- src/services/service.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/services/service.ts b/src/services/service.ts index 4fa1906..785088f 100755 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -1059,10 +1059,21 @@ export default class Services { for (const [processId, process] of Object.entries(newProcesses)) { const existing = await this.getProcess(processId); if (existing) { + // We check if we have public_data on the first state + if (Object.keys(process.states[0].public_data).length != 0) { + await this.saveProcessToDb(processId, process as Process); + const event = new CustomEvent('process-updated', { + detail: { processId } + }); + window.dispatchEvent(event); + continue; + } const lastKnownCommitment = this.getLastCommitedState(existing); const newLastCommitment = this.getLastCommitedState(process); if (!lastKnownCommitment || !newLastCommitment) { continue } if (lastKnownCommitment.commited_in !== newLastCommitment.commited_in) { + // Update the process in db with the new one + await this.saveProcessToDb(processId, process as Process); console.log('Dispatching process-updated event'); const event = new CustomEvent('process-updated', { detail: { processId }