From d7576d223dc87155e2df29767444f7cf5fe6bbe4 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 3 Feb 2016 15:34:20 +0000 Subject: [PATCH 1/2] Don't try to use local echoes as scroll tokens Local echoes don't have a (usable) event id, so don't use them when remembering the scroll state of a room. --- src/components/structures/RoomView.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index c46149bfeb..09b6baf2be 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -995,8 +995,18 @@ module.exports = React.createClass({ var eventId = mxEv.getId(); var highlight = (eventId == this.props.highlightedEventId); + + var scrollToken = eventId; + // we can't use local echoes as scroll tokens, because their event + // IDs change. + if (mxEv.status) { + scrollToken = undefined; + } + ret.push( -
  • +
  • From 8f5c73988649d8251dba5cde3c8d8150f1b10b4c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 4 Feb 2016 14:05:16 +0000 Subject: [PATCH 2/2] Clean up scrollToken assignment --- src/components/structures/RoomView.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 09b6baf2be..6e9835834a 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -996,12 +996,9 @@ module.exports = React.createClass({ var eventId = mxEv.getId(); var highlight = (eventId == this.props.highlightedEventId); - var scrollToken = eventId; - // we can't use local echoes as scroll tokens, because their event - // IDs change. - if (mxEv.status) { - scrollToken = undefined; - } + // we can't use local echoes as scroll tokens, because their event IDs change. + // Local echos have a send "status". + var scrollToken = mxEv.status ? undefined : eventId; ret.push(