Fix Left Panel layout being wrong when filtering with 0 rooms

This commit is contained in:
Michael Telatynski 2020-11-11 12:56:20 +00:00
parent f73573881e
commit d5c399dfd9

View File

@ -46,6 +46,7 @@ interface IProps {
}
interface IState {
isFiltering: boolean;
showBreadcrumbs: boolean;
showGroupFilterPanel: boolean;
}
@ -70,6 +71,7 @@ export default class LeftPanel extends React.Component<IProps, IState> {
super(props);
this.state = {
isFiltering: !!RoomListStore.instance.getFirstNameFilterCondition(),
showBreadcrumbs: BreadcrumbsStore.instance.visible,
showGroupFilterPanel: SettingsStore.getValue('TagPanel.enableTagPanel'),
};
@ -102,9 +104,10 @@ export default class LeftPanel extends React.Component<IProps, IState> {
};
private onBreadcrumbsUpdate = () => {
const newVal = BreadcrumbsStore.instance.visible;
if (newVal !== this.state.showBreadcrumbs) {
this.setState({showBreadcrumbs: newVal});
const showBreadcrumbs = BreadcrumbsStore.instance.visible;
const isFiltering = !!RoomListStore.instance.getFirstNameFilterCondition();
if (showBreadcrumbs !== this.state.showBreadcrumbs || isFiltering !== this.state.isFiltering) {
this.setState({showBreadcrumbs, isFiltering});
// Update the sticky headers too as the breadcrumbs will be popping in or out.
if (!this.listContainerRef.current) return; // ignore: no headers to sticky