diff --git a/src/View/ChatPages/messagePage.tsx b/src/View/ChatPages/messagePage.tsx index a1af6601..aab3ea60 100644 --- a/src/View/ChatPages/messagePage.tsx +++ b/src/View/ChatPages/messagePage.tsx @@ -7,7 +7,7 @@ import MessagePageViewModel from "../../ViewModel/Pages/messagePageViewModel"; import { translations } from "../translations"; export function MessagePage(messagePageViewModel: MessagePageViewModel) { - messagePageViewModel.loadMessages(); + messagePageViewModel.loadData(); const messageContainer = (
{ - this.cannotSendMessage = React.createProxyState( - [this.chatViewModel.settingsViewModel.username, this.composingMessage], - () => - this.chatViewModel.settingsViewModel.username.value == "" || - this.composingMessage.value == "" - ); - }; - - loadMessages = (): void => { for (const chatMessage of this.chatViewModel.chatModel.messages) { this.addChatMessage(chatMessage); } @@ -72,6 +63,12 @@ export default class MessagePageViewModel { // init constructor(chatViewModel: ChatViewModel) { this.chatViewModel = chatViewModel; - this.loadData(); + + this.cannotSendMessage = React.createProxyState( + [this.chatViewModel.settingsViewModel.username, this.composingMessage], + () => + this.chatViewModel.settingsViewModel.username.value == "" || + this.composingMessage.value == "" + ); } } diff --git a/src/ViewModel/Pages/settingsPageViewModel.ts b/src/ViewModel/Pages/settingsPageViewModel.ts index 498da96c..7ffe66b4 100644 --- a/src/ViewModel/Pages/settingsPageViewModel.ts +++ b/src/ViewModel/Pages/settingsPageViewModel.ts @@ -89,13 +89,6 @@ export default class SettingsPageViewModel { this.chatViewModel.chatModel.info.primaryChannel; this.color.value = this.chatViewModel.chatModel.color; - - this.cannotSetEncryptionKey = React.createProxyState( - [this.encryptionKeyInput], - () => - this.encryptionKeyInput.value == - this.chatViewModel.chatModel.info.encryptionKey - ); }; loadData = (): void => { @@ -120,5 +113,12 @@ export default class SettingsPageViewModel { constructor(chatViewModel: ChatViewModel) { this.chatViewModel = chatViewModel; this.loadListRelevantData(); + + this.cannotSetEncryptionKey = React.createProxyState( + [this.encryptionKeyInput], + () => + this.encryptionKeyInput.value == + this.chatViewModel.chatModel.info.encryptionKey + ); } }