force message view refresh on subscription update, #127

This commit is contained in:
or-else
2023-05-12 13:40:37 -07:00
parent 852a1a7c4e
commit c5c55fd9fd
20 changed files with 52 additions and 672 deletions
+4 -3
View File
@@ -298,7 +298,8 @@ class MessagesView extends React.Component {
reply: null,
contentToEdit: null,
showGoToLastButton: false,
dragging: false
dragging: false,
subsVersion: 0
};
} else if (nextProps.topic != prevState.topic) {
const topic = nextProps.tinode.getTopic(nextProps.topic);
@@ -669,12 +670,12 @@ class MessagesView extends React.Component {
if (this.state.topic) {
const subs = [];
const topic = this.props.tinode.getTopic(this.state.topic);
topic.subscribers((sub) => {
topic.subscribers(sub => {
if (sub.online && sub.user != this.props.myUserId) {
subs.push(sub);
}
});
const newState = {onlineSubs: subs};
const newState = {onlineSubs: subs, subsVersion: this.state.subsVersion + 1};
const peer = topic.p2pPeerDesc();
if (peer) {
Object.assign(newState, {