Skip to content

Commit

Permalink
chore(filter): unload groups & accounts on unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Jun 9, 2019
1 parent 395b0e3 commit 88bc20b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/client/containers/Modals/FilterTicketsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import PropTypes from 'prop-types'
import { each } from 'lodash'
import { connect } from 'react-redux'
import { hideModal } from 'actions/common'
import { fetchGroups } from 'actions/groups'
import { fetchAccounts } from 'actions/accounts'
import { fetchGroups, unloadGroups } from 'actions/groups'
import { fetchAccounts, unloadAccounts } from 'actions/accounts'

import BaseModal from 'containers/Modals/BaseModal'
import SingleSelect from 'components/SingleSelect'
Expand All @@ -40,6 +40,11 @@ class FilterTicketsModal extends React.Component {
helpers.UI.reRenderInputs()
}

componentWillUnmount () {
this.props.unloadGroups()
this.props.unloadAccounts()
}

onSubmit (e) {
e.preventDefault()
const startDate = e.target.filterDate_Start.value
Expand Down Expand Up @@ -204,7 +209,9 @@ FilterTicketsModal.propTypes = {
accountsState: PropTypes.object.isRequired,
hideModal: PropTypes.func.isRequired,
fetchGroups: PropTypes.func.isRequired,
fetchAccounts: PropTypes.func.isRequired
unloadGroups: PropTypes.func.isRequired,
fetchAccounts: PropTypes.func.isRequired,
unloadAccounts: PropTypes.func.isRequired
}

const mapStateToProps = state => ({
Expand All @@ -215,5 +222,5 @@ const mapStateToProps = state => ({

export default connect(
mapStateToProps,
{ hideModal, fetchGroups, fetchAccounts }
{ hideModal, fetchGroups, unloadGroups, fetchAccounts, unloadAccounts }
)(FilterTicketsModal)

0 comments on commit 88bc20b

Please sign in to comment.