mirror of https://github.com/vector-im/riot-web
check overflow and restore sizes in more places inside RoomList:
check overflow on mount restore size on query change (in case a sublist appeared) check overflow when updating rooms avoid duplicating for restoring size and checking overflowpull/21833/head
parent
b359a2edee
commit
cdcb3c1a55
|
@ -152,6 +152,8 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
this.subListSizes[id] = newSize;
|
this.subListSizes[id] = newSize;
|
||||||
window.localStorage.setItem("mx_roomlist_sizes", JSON.stringify(this.subListSizes));
|
window.localStorage.setItem("mx_roomlist_sizes", JSON.stringify(this.subListSizes));
|
||||||
|
// update overflow indicators
|
||||||
|
this._checkSubListsOverflow();
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
@ -167,12 +169,10 @@ module.exports = React.createClass({
|
||||||
});
|
});
|
||||||
|
|
||||||
// load stored sizes
|
// load stored sizes
|
||||||
Object.entries(this.subListSizes).forEach(([id, size]) => {
|
Object.keys(this.subListSizes).forEach((key) => {
|
||||||
const handle = this.resizer.forHandleWithId(id);
|
this._restoreSubListSize(key);
|
||||||
if (handle) {
|
|
||||||
handle.resize(size);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
this._checkSubListsOverflow();
|
||||||
|
|
||||||
this.resizer.attach();
|
this.resizer.attach();
|
||||||
this.mounted = true;
|
this.mounted = true;
|
||||||
|
@ -181,7 +181,11 @@ module.exports = React.createClass({
|
||||||
componentDidUpdate: function(prevProps) {
|
componentDidUpdate: function(prevProps) {
|
||||||
this._repositionIncomingCallBox(undefined, false);
|
this._repositionIncomingCallBox(undefined, false);
|
||||||
if (this.props.searchFilter !== prevProps.searchFilter) {
|
if (this.props.searchFilter !== prevProps.searchFilter) {
|
||||||
Object.values(this._subListRefs).forEach(l => l.checkOverflow());
|
// restore sizes
|
||||||
|
Object.keys(this.subListSizes).forEach((key) => {
|
||||||
|
this._restoreSubListSize(key);
|
||||||
|
});
|
||||||
|
this._checkSubListsOverflow();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -354,6 +358,12 @@ module.exports = React.createClass({
|
||||||
// Do this here so as to not render every time the selected tags
|
// Do this here so as to not render every time the selected tags
|
||||||
// themselves change.
|
// themselves change.
|
||||||
selectedTags: TagOrderStore.getSelectedTags(),
|
selectedTags: TagOrderStore.getSelectedTags(),
|
||||||
|
}, () => {
|
||||||
|
// we don't need to restore any size here, do we?
|
||||||
|
// i guess we could have triggered a new group to appear
|
||||||
|
// that already an explicit size the last time it appeared ...
|
||||||
|
//
|
||||||
|
this._checkSubListsOverflow();
|
||||||
});
|
});
|
||||||
|
|
||||||
// this._lastRefreshRoomListTs = Date.now();
|
// this._lastRefreshRoomListTs = Date.now();
|
||||||
|
@ -491,14 +501,23 @@ module.exports = React.createClass({
|
||||||
window.localStorage.setItem("mx_roomlist_collapsed", JSON.stringify(this.collapsedState));
|
window.localStorage.setItem("mx_roomlist_collapsed", JSON.stringify(this.collapsedState));
|
||||||
// load the persisted size configuration of the expanded sub list
|
// load the persisted size configuration of the expanded sub list
|
||||||
if (!collapsed) {
|
if (!collapsed) {
|
||||||
|
this._restoreSubListSize(key);
|
||||||
|
}
|
||||||
|
// check overflow, as sub lists sizes have changed
|
||||||
|
// important this happens after calling resize above
|
||||||
|
this._checkSubListsOverflow();
|
||||||
|
},
|
||||||
|
|
||||||
|
_restoreSubListSize(key) {
|
||||||
const size = this.subListSizes[key];
|
const size = this.subListSizes[key];
|
||||||
const handle = this.resizer.forHandleWithId(key);
|
const handle = this.resizer.forHandleWithId(key);
|
||||||
if (handle) {
|
if (handle) {
|
||||||
handle.resize(size);
|
handle.resize(size);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
// check overflow, as sub lists sizes have changed
|
|
||||||
// important this happens after calling resize above
|
// check overflow for scroll indicator gradient
|
||||||
|
_checkSubListsOverflow() {
|
||||||
Object.values(this._subListRefs).forEach(l => l.checkOverflow());
|
Object.values(this._subListRefs).forEach(l => l.checkOverflow());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue