-
Notifications
You must be signed in to change notification settings - Fork 51
fix(PM-2353): reset filter on viewing list view #1688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v6
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,7 @@ class ChallengeCard extends React.Component { | |
this.deleteModalLaunch = this.deleteModalLaunch.bind(this) | ||
this.resetModal = this.resetModal.bind(this) | ||
this.onLaunchChallenge = this.onLaunchChallenge.bind(this) | ||
this.openChallengeView = this.openChallengeView.bind(this) | ||
} | ||
|
||
getForumLink (challenge) { | ||
|
@@ -204,9 +205,14 @@ class ChallengeCard extends React.Component { | |
} | ||
} | ||
|
||
openChallengeView (challenge) { | ||
this.props.setActiveProject(parseInt(challenge.projectId)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding error handling for the |
||
this.props.resetFilter() | ||
} | ||
|
||
render () { | ||
const { isLaunch, isConfirm, isSaving, isDeleteLaunch, isCheckChalengePermission, hasEditChallengePermission, currentPhase, forumLink } = this.state | ||
const { setActiveProject, challenge, reloadChallengeList, isBillingAccountExpired, disableHover, getStatusText, challengeTypes, loginUserRoleInProject } = this.props | ||
const { challenge, reloadChallengeList, isBillingAccountExpired, disableHover, getStatusText, challengeTypes, loginUserRoleInProject } = this.props | ||
const deleteMessage = isCheckChalengePermission | ||
? 'Checking permissions...' | ||
: `Do you want to delete "${challenge.name}"?` | ||
|
@@ -265,7 +271,7 @@ class ChallengeCard extends React.Component { | |
/> | ||
</div> | ||
|
||
<Link className={styles.col2} to={`/projects/${challenge.projectId}/challenges/${challenge.id}/view`} onClick={() => setActiveProject(parseInt(challenge.projectId))}> | ||
<Link className={styles.col2} to={`/projects/${challenge.projectId}/challenges/${challenge.id}/view`} onClick={() => this.openChallengeView(challenge)}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function |
||
<div className={styles.name}> | ||
<span className={styles.link}>{challenge.name}</span> | ||
</div> | ||
|
@@ -291,7 +297,7 @@ class ChallengeCard extends React.Component { | |
{ | ||
!isReadOnly && ( | ||
<div className={styles.col6}> | ||
{(disableHover ? <Link className={styles.link} to={`/projects/${challenge.projectId}/challenges/${challenge.id}/edit`}>Edit</Link> : hoverComponents(challenge, this.onUpdateLaunch, this.deleteModalLaunch))} | ||
{(disableHover ? <Link className={styles.link} to={`/projects/${challenge.projectId}/challenges/${challenge.id}/edit`} onClick={() => this.props.resetFilter()}>Edit</Link> : hoverComponents(challenge, this.onUpdateLaunch, this.deleteModalLaunch))} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider checking if |
||
</div> | ||
) | ||
} | ||
|
@@ -328,7 +334,8 @@ ChallengeCard.propTypes = { | |
getStatusText: PropTypes.func, | ||
challengeTypes: PropTypes.arrayOf(PropTypes.shape()), | ||
auth: PropTypes.object.isRequired, | ||
loginUserRoleInProject: PropTypes.string | ||
loginUserRoleInProject: PropTypes.string, | ||
resetFilter: PropTypes.func | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
} | ||
|
||
export default withRouter(ChallengeCard) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
openChallengeView
method should be bound tothis
in the constructor if it is intended to be used as an event handler or passed around as a callback. This ensures the correctthis
context is maintained.