This commit is contained in:
or-else
2023-05-10 13:20:40 -07:00
parent c15092e850
commit 852a1a7c4e
11 changed files with 14 additions and 43 deletions
-12
View File
@@ -209,18 +209,6 @@ class MessagesView extends React.Component {
}
componentDidUpdate(prevProps, prevState) {
const p = [];
const s = [];
Object.entries(this.props).forEach(([key, val]) =>
prevProps[key] !== val && p.push(key)
);
if (this.state) {
Object.entries(this.state).forEach(([key, val]) =>
prevState[key] !== val && s.push(key)
);
}
console.log(`Prop '${p}', state '${s}' changed`);
// Scroll last message into view on component update e.g. on message received
// or vertical shrinking.
if (this.messagesScroller &&
+3 -3
View File
@@ -848,7 +848,7 @@ class TinodeWeb extends React.Component {
}
} else if (what == 'read') {
this.resetContactList();
} else if (what == 'msg') {
} else if (what == 'msg' && cont) {
// Check if the topic is archived. If so, don't play a sound.
const topic = this.tinode.getTopic(cont.topic);
const archived = topic && topic.isArchived();
@@ -870,7 +870,6 @@ class TinodeWeb extends React.Component {
// Topic deleted or user unsubscribed. Remove topic from view.
// If the currently selected topic is gone, clear the selection.
if (this.state.topicSelected == cont.topic) {
console.log("tnMeContactUpdate", cont.topic, what);
this.handleTopicSelected(null);
}
// Redraw without the deleted topic.
@@ -888,7 +887,7 @@ class TinodeWeb extends React.Component {
} else {
// TODO(gene): handle other types of notifications:
// * ua -- user agent changes (maybe display a pictogram for mobile/desktop).
console.info("Unsupported (yet) presence update:", what, "in", cont.topic);
console.info("Unsupported (yet) presence update:", what, "in", (cont || {}).topic);
}
}
@@ -1020,6 +1019,7 @@ class TinodeWeb extends React.Component {
} else {
// Currently selected contact deleted
this.setState({
topicSelected: null,
errorText: '',
errorLevel: null,
mobilePanel: 'sidepanel',