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

View File

@ -16,7 +16,9 @@ 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() {
@ -24,6 +26,12 @@ class GroupPage extends ImmutablePureComponent {
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 {
intl, intl,