Web: Common: Refactoring HOC withLayoutSize

This commit is contained in:
Alexey Kostenko 2020-11-17 10:32:02 +03:00
parent c6d4b5bf60
commit 3702bd597d
3 changed files with 4 additions and 6 deletions

View File

@ -290,15 +290,14 @@ class SectionFilterContent extends React.Component {
this.state.isReady !== nextState.isReady ||
this.props.viewAs !== nextProps.viewAs ||
this.props.firstLoad !== nextProps.firstLoad ||
!isEqual(this.props.context, nextProps.context)
this.props.sectionWidth !== nextProps.sectionWidth
);
}
render() {
console.log("Filter render");
const selectedFilterData = this.getSelectedFilterData();
const { t, language, firstLoad, context } = this.props;
const { sectionWidth } = context;
const { t, language, firstLoad, sectionWidth } = this.props;
const filterColumnCount =
window.innerWidth < 500 ? {} : { filterColumnCount: 3 };
return firstLoad ? (

View File

@ -250,8 +250,7 @@ class SectionFilterContent extends React.Component {
render() {
const selectedFilterData = this.getSelectedFilterData();
const { t, language, isLoaded, context } = this.props;
const { sectionWidth } = context;
const { t, language, isLoaded, sectionWidth } = this.props;
return isLoaded ? (
<FilterInput
sectionWidth={sectionWidth}

View File

@ -7,7 +7,7 @@ export function withLayoutSize(Component) {
return (
<Consumer>
{(context) => {
return <Component {...props} context={context} />;
return <Component {...props} {...context} />;
}}
</Consumer>
);