Updated GroupPage to fetch group on component update if id changes

• Updated:
- GroupPage to fetch group on component update if id changes

• Fixes:
- Issue where going from group -> group (like from shortcut to shortcut) and the group children components dont update
This commit is contained in:
mgabdev 2020-12-31 19:13:10 -05:00
parent 985faeb930
commit af7c82221d
1 changed files with 9 additions and 1 deletions

View File

@ -16,13 +16,21 @@ import Divider from '../components/divider'
class GroupPage extends ImmutablePureComponent { class GroupPage extends ImmutablePureComponent {
componentDidMount() { componentDidMount() {
this.props.dispatch(fetchGroup(this.props.params.id)) if (!this.props.group) {
this.props.dispatch(fetchGroup(this.props.params.id))
}
} }
componentWillUnmount() { componentWillUnmount() {
//Reset group composer //Reset group composer
this.props.dispatch(changeComposeGroupId(null)) this.props.dispatch(changeComposeGroupId(null))
} }
componentDidUpdate(prevProps) {
if (!!this.props.group && prevProps.params.id !== this.props.params.id) {
this.props.dispatch(fetchGroup(this.props.params.id))
}
}
render() { render() {
const { const {