Don't send process-updated event for process unchanged
This commit is contained in:
parent
db07abaa8a
commit
5bda1736e1
@ -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 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user