Skip to content

Commit 4e2817a

Browse files
committed
Fixed timer for mark conversation read
1 parent 066222b commit 4e2817a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/app/components/Chat.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const Chat = (props) => {
112112

113113
const componentJustMounted = useRef(true);
114114

115-
this.timer = null
115+
let timer = null
116116
useEffect(() => {
117117
setSelectedUri(props.focusOn);
118118
}, [props.focusOn]);
@@ -359,10 +359,10 @@ const Chat = (props) => {
359359
timestamp,
360360
state
361361
);
362-
if (this.timer !== null) {
363-
clearTimeout(this.timer);
362+
if (timer !== null) {
363+
clearTimeout(timer);
364364
}
365-
this.timer = setTimeout(() => {
365+
timer = setTimeout(() => {
366366
let sendMark = true;
367367
for (let message of messages[uri]) {
368368
if (message.state === 'received'
@@ -381,7 +381,7 @@ const Chat = (props) => {
381381
setUnread(uri)
382382
}
383383
props.account.markConversationRead(uri);
384-
this.timer = null;
384+
timer = null;
385385
}
386386
}, 500);
387387
};

0 commit comments

Comments
 (0)