mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-23 03:25:07 +03:00
Fix null issues
This commit is contained in:
@@ -22,7 +22,7 @@ export interface MessagePanelCallbacks {
|
||||
export abstract class MessagePanel {
|
||||
protected state: MessagePanelState;
|
||||
protected callbacks: MessagePanelCallbacks;
|
||||
public onStateChange: (state: MessagePanelState) => void;
|
||||
public onStateChange: ((state: MessagePanelState) => void) | null;
|
||||
protected currentUser: UserState;
|
||||
|
||||
constructor(
|
||||
@@ -57,7 +57,9 @@ export abstract class MessagePanel {
|
||||
// Common methods
|
||||
protected updateState(updates: Partial<MessagePanelState>): void {
|
||||
this.state = { ...this.state, ...updates };
|
||||
this.onStateChange(this.state);
|
||||
if (this.onStateChange) {
|
||||
this.onStateChange(this.state);
|
||||
}
|
||||
}
|
||||
|
||||
protected addMessage(message: Message): void {
|
||||
|
||||
Reference in New Issue
Block a user