Skip to content
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

Avoid creating multiple forms #2883

Merged
merged 1 commit into from Nov 20, 2019
Merged

Conversation

victoria34
Copy link
Contributor

Avoid creating multiple popup modals

@@ -48,6 +53,10 @@ export default class TrialMatchTable extends React.Component<ITrialMatchProps> {
}

@observable showTrialFeedback = false;
@observable selectedTrial: ISelectedTrial = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by default this should be undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@@ -196,6 +196,12 @@ export default class TrialMatchTable extends React.Component<ITrialMatchProps> {
);
}

public openFeedbackForm(nctId: string, protocolNo: string) {
this.showTrialFeedback = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of having a flag, you can just can just have selectedTrialFeedbackFormData which is either undefined (hide) or shown (populated). In general, it's best not to update multiple properties like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the flag

@@ -196,6 +196,12 @@ export default class TrialMatchTable extends React.Component<ITrialMatchProps> {
);
}

public openFeedbackForm(nctId: string, protocolNo: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this modifies mobx state and so should have @action decorator

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added @action

@@ -335,6 +339,17 @@ export default class TrialMatchTable extends React.Component<ITrialMatchProps> {
title="OncoKB Matched Trials General Feedback"
userEmailAddress={AppConfig.serverConfig.user_email_address}
/>
{ this.selectedTrialFeedbackFormData &&
<TrialMatchFeedback
show={!!this.selectedTrialFeedbackFormData}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need show prop and internal logic anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the logic here because the window always popup the Exit Confirmation modal.
Screen Shot 2019-11-19 at 6 04 58 PM

{ this.selectedTrialFeedbackFormData &&
<TrialMatchFeedback
show={!!this.selectedTrialFeedbackFormData}
onHide={() => !!(this.selectedTrialFeedbackFormData=undefined)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onHide also modifies state so should be action. What I would do is change openFeedbackForm to openCloseFeedbackForm and have it accept undefined if it's close

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@victoria34 victoria34 force-pushed the google-form branch 2 times, most recently from c05d1e1 to aa786e3 Compare November 19, 2019 23:11
@alisman alisman merged commit 594f846 into cBioPortal:master Nov 20, 2019
@inodb inodb added the external api This PR is related to handling an external API label Nov 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external api This PR is related to handling an external API
Projects
None yet
3 participants