From fade36ec5432dbd82a5530f9ebeb8e2e72670d30 Mon Sep 17 00:00:00 2001 From: Felicio Mununga Date: Mon, 13 Jun 2022 22:44:12 +0200 Subject: [PATCH] Return new array on emit to trigger re-rendering in react (#273) * fix type * return new array to trigger re-rendering in react --- packages/status-js/src/client/chat.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/status-js/src/client/chat.ts b/packages/status-js/src/client/chat.ts index 7e294f09..7fe98c59 100644 --- a/packages/status-js/src/client/chat.ts +++ b/packages/status-js/src/client/chat.ts @@ -120,7 +120,7 @@ export class Chat { const startTime = options.start const endTime = new Date() - let _oldestClock: BigInt | undefined + let _oldestClock: bigint | undefined let _oldestMessageTime: Date | undefined if (this.messages.length) { @@ -169,7 +169,7 @@ export class Chat { public emitMessages = (messages: ChatMessage[]) => { // fixme!: don't emit on backfill - this.messageCallbacks.forEach(callback => callback(messages)) + this.messageCallbacks.forEach(callback => callback([...messages])) } public handleChange = (description: CommunityChat) => {