Web: Files: Refactoring

This commit is contained in:
Alexey Safronov 2021-03-19 21:11:22 +03:00
parent e797d01bee
commit 1908c2d608

View File

@ -258,30 +258,13 @@ class SectionFilterContent extends React.Component {
return selectedFilterData;
};
needForUpdate = (currentProps, nextProps) => {
if (currentProps.language !== nextProps.language) {
return true;
}
return false;
};
// shouldComponentUpdate(nextProps, nextState) {
// return (
// !equal(this.props.filter, nextProps.filter) ||
// this.props.selectedFolderId !== nextProps.selectedFolderId ||
// this.state.isReady !== nextState.isReady ||
// this.props.viewAs !== nextProps.viewAs ||
// this.props.firstLoad !== nextProps.firstLoad ||
// this.props.sectionWidth !== nextProps.sectionWidth
// );
// }
render() {
//console.log("Filter render");
const selectedFilterData = this.getSelectedFilterData();
const { t, language, firstLoad, sectionWidth } = this.props;
const { t, firstLoad, sectionWidth } = this.props;
const filterColumnCount =
window.innerWidth < 500 ? {} : { filterColumnCount: 3 };
return firstLoad ? (
<Loaders.Filter />
) : (
@ -296,8 +279,6 @@ class SectionFilterContent extends React.Component {
directionAscLabel={t("DirectionAscLabel")}
directionDescLabel={t("DirectionDescLabel")}
placeholder={t("Search")}
needForUpdate={this.needForUpdate}
language={language}
isReady={this.state.isReady}
{...filterColumnCount}
contextMenuHeader={t("AddFilter")}
@ -314,12 +295,10 @@ export default inject(
const { user } = auth.userStore;
const { customNames, culture } = auth.settingsStore;
const language = (user && user.cultureName) || culture || "en-US";
return {
customNames,
user,
language,
firstLoad,
selectedFolderId: selectedFolderStore.id,
selectedItem: filter.selectedItem,