Return new array on emit to trigger re-rendering in react (#273)

* fix type

* return new array to trigger re-rendering in react
This commit is contained in:
Felicio Mununga 2022-06-13 22:44:12 +02:00 committed by GitHub
parent f62e3ff014
commit fade36ec54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -120,7 +120,7 @@ export class Chat {
const startTime = options.start const startTime = options.start
const endTime = new Date() const endTime = new Date()
let _oldestClock: BigInt | undefined let _oldestClock: bigint | undefined
let _oldestMessageTime: Date | undefined let _oldestMessageTime: Date | undefined
if (this.messages.length) { if (this.messages.length) {
@ -169,7 +169,7 @@ export class Chat {
public emitMessages = (messages: ChatMessage[]) => { public emitMessages = (messages: ChatMessage[]) => {
// fixme!: don't emit on backfill // fixme!: don't emit on backfill
this.messageCallbacks.forEach(callback => callback(messages)) this.messageCallbacks.forEach(callback => callback([...messages]))
} }
public handleChange = (description: CommunityChat) => { public handleChange = (description: CommunityChat) => {