From bbbc16be25f206af96aee7b4a26e8ad53ec3ff47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Wed, 1 Nov 2023 20:49:31 +0100 Subject: [PATCH] sdk: only send events if we have any --- packages/sdk/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/sdk/index.ts b/packages/sdk/index.ts index 4d00d921..851582a6 100644 --- a/packages/sdk/index.ts +++ b/packages/sdk/index.ts @@ -111,8 +111,11 @@ class Batcher { if(this.timer) { clearTimeout(this.timer) } - this.callback(this.queue) - this.queue = [] + + if(this.queue.length > 0) { + this.callback(this.queue) + this.queue = [] + } } }