Don't reset cached room list values when they are falsey
`unread` and `unread-muted` store booleans in the cache, and can easily be `false`. Without this patch, both of those cached types would be cleared from the object where a later call to `getRoomState` would try and re-populate them. `getRoomState` is supposed to use the cache where possible to avoid making the more expensive calls required to calculate those booleans. On my account in a test environment, this brings the `generateRoomLists` execution time down from ~250ms to just ~30ms. This still does not solve the whole issue, but should solve the more common case of performance woes for people.
This commit is contained in:
parent
a1daecc249
commit
66cd8475b5
1 changed files with 1 additions and 1 deletions
|
@ -277,7 +277,7 @@ class RoomListStore extends Store {
|
|||
const roomCache = this._state.roomCache;
|
||||
if (!roomCache[roomId]) roomCache[roomId] = {};
|
||||
|
||||
if (value) roomCache[roomId][type] = value;
|
||||
if (typeof value !== "undefined") roomCache[roomId][type] = value;
|
||||
else delete roomCache[roomId][type];
|
||||
|
||||
this._setState({roomCache});
|
||||
|
|
Loading…
Reference in a new issue