From 8cf6a8c3112fb49c18a440bcadf8a775b72837ec Mon Sep 17 00:00:00 2001 From: thobyv-kismat Date: Sat, 11 Apr 2020 02:59:26 +0100 Subject: [PATCH] refactor RoomScrollStateStore to accomodate scrollmaps for file/notif panel --- src/components/structures/RoomView.js | 4 ++-- src/stores/RoomScrollStateStore.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 4a3666fc38..291297a815 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -269,7 +269,7 @@ export default createReactClass({ // If an event ID wasn't specified, default to the one saved for this room // in the scroll state store. Assume initialEventPixelOffset should be set. if (!newState.initialEventId) { - const roomScrollState = RoomScrollStateStore.getScrollState(newState.roomId); + const roomScrollState = RoomScrollStateStore.getRoomViewScrollState(newState.roomId); if (roomScrollState) { newState.initialEventId = roomScrollState.focussedEvent; newState.initialEventPixelOffset = roomScrollState.pixelOffset; @@ -470,7 +470,7 @@ export default createReactClass({ // update the scroll map before we get unmounted if (this.state.roomId) { - RoomScrollStateStore.setScrollState(this.state.roomId, this._getScrollState()); + RoomScrollStateStore.setRoomViewScrollState(this.state.roomId, this._getScrollState()); } if (this.state.shouldPeek) { diff --git a/src/stores/RoomScrollStateStore.js b/src/stores/RoomScrollStateStore.js index 07848283d1..37440c3e81 100644 --- a/src/stores/RoomScrollStateStore.js +++ b/src/stores/RoomScrollStateStore.js @@ -32,15 +32,15 @@ class RoomScrollStateStore { // // pixelOffset: the number of pixels the window is scrolled down // from the focussedEvent. - this._scrollStateMap = {}; + this._RoomViewScrollStateMap = {}; } - getScrollState(roomId) { - return this._scrollStateMap[roomId]; + getRoomViewScrollState(roomId) { + return this._RoomViewScrollStateMap[roomId]; } - setScrollState(roomId, scrollState) { - this._scrollStateMap[roomId] = scrollState; + setRoomViewScrollState(roomId, scrollState) { + this._RoomViewScrollStateMap[roomId] = scrollState; } }