diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-01-06 06:51:45 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-01-09 10:36:51 +0300 |
commit | e41cbbd20e901c5387e95fb23ab9ec7a4e045d1f (patch) | |
tree | f41861aa707851f16d4fe7acff963c8a6e019ff0 /src | |
parent | a4896cc4f718ce8114af3a92f175436e2c3cfe89 (diff) |
Prevent trying to get new messages on a destroyed MessagesList
As "getNewMessages" is enqueued to be executed in the next tick it could
happen (even if it is extremely rare) that the MessagesList component is
destroyed in the meantime. If that happens the component is disconnected
from the store, so it can access only those values already known. Due to
this the last known message ID is never updated, so when a new message
is sent the MessagesList enters in a infinite loop trying to get the new
messages again and again always using an old message ID.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/MessagesList/MessagesList.vue | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/components/MessagesList/MessagesList.vue b/src/components/MessagesList/MessagesList.vue index 60fbfe94e..2381bd809 100644 --- a/src/components/MessagesList/MessagesList.vue +++ b/src/components/MessagesList/MessagesList.vue @@ -310,6 +310,11 @@ export default { await this.getOldMessages() // Once the history is received, startslooking for new messages. this.$nextTick(() => { + if (this._isBeingDestroyed || this._isDestroyed) { + console.debug('Prevent getting new messages on a destroyed MessagesList') + return + } + this.getNewMessages() }) }, |