From a7f8b011cf61716aec30b6ee75bc5b3b6c9b89d6 Mon Sep 17 00:00:00 2001 From: Xueying Wang Date: Mon, 29 Jan 2024 14:48:13 +0100 Subject: [PATCH] fix api-derive subscribeFinalizedBlocks only emits latest block from the block range --- packages/api-derive/src/chain/subscribeFinalizedBlocks.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/api-derive/src/chain/subscribeFinalizedBlocks.ts b/packages/api-derive/src/chain/subscribeFinalizedBlocks.ts index 426d363a3573..e8c24210e461 100644 --- a/packages/api-derive/src/chain/subscribeFinalizedBlocks.ts +++ b/packages/api-derive/src/chain/subscribeFinalizedBlocks.ts @@ -5,7 +5,7 @@ import type { Observable } from 'rxjs'; import type { SignedBlockExtended } from '../type/types.js'; import type { DeriveApi } from '../types.js'; -import { switchMap } from 'rxjs'; +import { concatMap } from 'rxjs'; import { memo } from '../util/index.js'; @@ -16,7 +16,7 @@ import { memo } from '../util/index.js'; export function subscribeFinalizedBlocks (instanceId: string, api: DeriveApi): () => Observable { return memo(instanceId, (): Observable => api.derive.chain.subscribeFinalizedHeads().pipe( - switchMap((header) => + concatMap((header) => api.derive.chain.getBlock(header.createdAtHash || header.hash) ) )