From 5c41be428cfedefa16233375fd0bd75da0994eb6 Mon Sep 17 00:00:00 2001 From: "guillem.cordoba" Date: Thu, 4 Jul 2024 11:33:01 +0200 Subject: [PATCH] Fixed getAllDeletes signature --- packages/signals/package.json | 2 +- packages/signals/src/holochain.ts | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/signals/package.json b/packages/signals/package.json index 032e6e1..7acaa7d 100644 --- a/packages/signals/package.json +++ b/packages/signals/package.json @@ -1,6 +1,6 @@ { "name": "@holochain-open-dev/signals", - "version": "0.300.2", + "version": "0.300.3", "description": "Holochain async-signals to build reusable holochain-open-dev modules", "author": "guillem.cordoba@gmail.com", "main": "dist/index.js", diff --git a/packages/signals/src/holochain.ts b/packages/signals/src/holochain.ts index 467cda6..1a01222 100644 --- a/packages/signals/src/holochain.ts +++ b/packages/signals/src/holochain.ts @@ -185,7 +185,7 @@ export function immutableEntrySignal( }); } else { if (retries < maxRetries) { - setTimeout(() => tryFetch, pollInterval); + setTimeout(() => tryFetch(), pollInterval); } else { signal.set({ status: 'error', @@ -196,7 +196,7 @@ export function immutableEntrySignal( }) .catch(error => { if (retries < maxRetries) { - setTimeout(() => tryFetch, pollInterval); + setTimeout(() => tryFetch(), pollInterval); } else { signal.set({ status: 'error', @@ -453,13 +453,14 @@ export function deletesForEntrySignal< } }); if ( - !deletes || - !areArrayHashesEqual( - deletes.map(d => d.hashed.hash), - ndeletes.map(d => d.hashed.hash), - ) + ndeletes && + (!deletes || + !areArrayHashesEqual( + deletes.map(d => d.hashed.hash), + ndeletes.map(d => d.hashed.hash), + )) ) { - deletes = ndeletes; + deletes = uniquifyActions(ndeletes); signal.set({ status: 'completed', value: deletes, @@ -483,7 +484,7 @@ export function deletesForEntrySignal< originalActionHash.toString() ) { const lastDeletes = deletes ? deletes : []; - deletes = [...lastDeletes, hcSignal.action]; + deletes = uniquifyActions([...lastDeletes, hcSignal.action]); signal.set({ status: 'completed', value: deletes,