Skip to content

Commit

Permalink
Pop update functions as to not run them too many times
Browse files Browse the repository at this point in the history
  • Loading branch information
f-r00t committed Feb 28, 2024
1 parent fa31c3d commit 59398c5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,20 +809,22 @@ export class GroupChatScreenNoTranslation extends React.Component {
}


Globals.updateGroupsFunctions.push(async () => {
this.setState({
messages: await getGroupMessages(this.state.key, this.state.messages.length)
})
});


}

async componentDidMount() {

await markGroupConversationAsRead(this.state.key);
markGroupConversationAsRead(this.state.key);

let messages = await getGroupMessages(this.state.key, 25);

Globals.updateGroupsFunctions.push(async () => {
this.setState({
messages: await getGroupMessages(this.state.key, this.state.messages.length)
})
});

if (!messages) {
messages = [];
}
Expand All @@ -838,6 +840,7 @@ export class GroupChatScreenNoTranslation extends React.Component {
async componentWillUnmount() {

Globals.activeChat = '';
Globals.updateGroupsFunctions.pop();

}

Expand Down

0 comments on commit 59398c5

Please sign in to comment.