Ensure references to the room list store are broken for diffing

See commit diff for details.
This commit is contained in:
Travis Ralston 2020-07-24 10:38:04 -06:00
parent 0a31bd169c
commit 4d7980eb07
3 changed files with 38 additions and 2 deletions

View file

@ -42,7 +42,8 @@ import { ViewRoomDeltaPayload } from "../../../dispatcher/payloads/ViewRoomDelta
import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore";
import SettingsStore from "../../../settings/SettingsStore";
import CustomRoomTagStore from "../../../stores/CustomRoomTagStore";
import { arrayHasDiff } from "../../../utils/arrays";
import { arrayFastClone, arrayHasDiff } from "../../../utils/arrays";
import { objectShallowClone } from "../../../utils/objects";
interface IProps {
onKeyDown: (ev: React.KeyboardEvent) => void;
@ -255,7 +256,11 @@ export default class RoomList extends React.Component<IProps, IState> {
}
if (doUpdate) {
this.setState({sublists: newLists}, () => {
// We have to break our reference to the room list store if we want to be able to
// diff the object for changes, so do that.
const sublists = objectShallowClone(newLists, (k, v) => arrayFastClone(v));
this.setState({sublists: sublists}, () => {
this.props.onResize();
});
}