Commit 0459db15 authored by Denis Sedura's avatar Denis Sedura

[RNA-761] Fix bfw

parent 227e780f
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Router } from 'tipsi-router'
import { isEqual } from 'lodash'
import { isEqual, isEmpty } from 'lodash'
import { connect } from 'react-redux'
import { userSelector } from 'tipsi_api/selectors'
import { analyticsLogEvent } from '../../actions'
......@@ -19,7 +19,7 @@ function enhanceStore(ComposedComponent, StoreSearchInput, FiltersModal, Filters
class Wrapper extends Component {
static propTypes = {
// route props
title: PropTypes.string.isRequired,
title: PropTypes.string,
storeId: PropTypes.number.isRequired,
searchQuery: PropTypes.string,
tabIndex: PropTypes.number,
......@@ -35,6 +35,7 @@ function enhanceStore(ComposedComponent, StoreSearchInput, FiltersModal, Filters
}
static defaultProps = {
title: undefined,
// route props
searchQuery: '',
tabIndex: 0,
......@@ -48,7 +49,11 @@ function enhanceStore(ComposedComponent, StoreSearchInput, FiltersModal, Filters
}
componentWillMount() {
Router.setTitle(this.props.title)
if (this.props.title) {
Router.setTitle(this.props.title)
} else {
Router.setTitle(tabItems[this.state.tabIndex].title)
}
}
componentDidMount() {
......@@ -73,8 +78,10 @@ function enhanceStore(ComposedComponent, StoreSearchInput, FiltersModal, Filters
const { key: nextValue } = tabItems[tabIndex]
this.props.analyticsLogEvent('ui_storeTabView_changeTab_click', { currentValue, nextValue })
// updateRouteParams(this.props.navigator, { title: tabItems[tabIndex].title })
// Router.setTitle(tabItems[tabIndex].title)
if (isEmpty(this.props.title)) {
Router.setTitle(tabItems[tabIndex].title)
Router.updateParams()
}
this.setState({ tabIndex })
}
......
......@@ -46,7 +46,6 @@ function enhanceFilters(ComposedComponent) {
state = withInitialFilters(this.props.storeFilters)
shouldComponentUpdate(nextProps) {
console.log('shouldComponentUpdate', this.props, nextProps)
return !isEqual(this.props, nextProps)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment