@@ -4,9 +4,12 @@ import PropTypes from 'prop-types'
44import { Link } from 'react-router-dom'
55import { injectIntl } from 'react-intl'
66import MediaQuery from 'react-responsive'
7+ import queryString from 'query-string'
78import classNames from 'classnames'
89import _cloneDeep from 'lodash/cloneDeep'
910import _get from 'lodash/get'
11+ import _isFinite from 'lodash/isFinite'
12+ import _parseInt from 'lodash/parseInt'
1013import _isUndefined from 'lodash/isUndefined'
1114import AsEndUser from '../../interactions/User/AsEndUser'
1215import WithCurrentUser from '../../components/HOCs/WithCurrentUser/WithCurrentUser'
@@ -63,6 +66,19 @@ export class ReviewTasksDashboard extends Component {
6366 }
6467
6568 componentDidUpdate ( prevProps ) {
69+ if ( ! this . state . filterSelected [ this . state . showType ] &&
70+ _get ( this . props . history , 'location.search' ) ) {
71+ const urlParams = queryString . parse ( _get ( this . props , 'location.search' ) )
72+ if ( _isFinite ( _parseInt ( urlParams . challengeId ) ) ) {
73+ this . setSelectedChallenge ( urlParams . challengeId , urlParams . challengeName )
74+ return
75+ }
76+ else if ( _isFinite ( _parseInt ( urlParams . projectId ) ) ) {
77+ this . setSelectedProject ( urlParams . projectId , urlParams . projectName )
78+ return
79+ }
80+ }
81+
6682 if ( this . props . location . pathname !== prevProps . location . pathname &&
6783 this . props . location . search !== prevProps . location . search ) {
6884 window . scrollTo ( 0 , 0 )
@@ -103,6 +119,9 @@ export class ReviewTasksDashboard extends Component {
103119 const filterSelected = _cloneDeep ( this . state . filterSelected )
104120 filterSelected [ this . state . showType ] = null
105121 this . setState ( { filterSelected} )
122+ this . props . history . push ( {
123+ pathname : `/review/${ this . state . showType } `
124+ } )
106125 }
107126
108127 changeTab = ( tab ) => {
0 commit comments