-
Notifications
You must be signed in to change notification settings - Fork 136
Disable "Save Changes" button again if there is no changes. #3175
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
Conversation
maxceem
left a comment
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.
Thanks @gets0ul.
As has been mentioned in the comment to the previous PR #3150 (review):
But the fix should be general as described above. Other words we should not use names of the specific field like
appDefinition,features,notes,targetDevicesand so on, or specific field values likeweb-browser.
But in proposed implemenation there is some logic which is bound for particular templates as it uses references to budgetDetails, deliverables, dev, development, data-science, dataScience, deploymentTargets, progressiveResponsive and so on.
All these values are just some particular data in one project template. It could be different values and our intention here is to compare any data without binding to a particular project template.
Can we have a general fix for this issue, without binding to the particular project data?
|
@maxceem |
|
@maxceem From #3150 (review)
It's easy if the value were empty string, empty object or an empty array. It's already taken care by general fix of my code. The problem here if the value is none of above. Same as https://connect.topcoder-dev.com/projects/8197/scope For the first example, it's easier to solve as it requires the discipline of the app user. But it is not that easy for the 2nd example as it came from radio button value and there is no way to reset/deselect it. Having said that, I will try to look if a general fix that covering all cases is possible. |
|
@maxceem |
maxceem
left a comment
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.
@gets0ul that's a great update without using hardcoded values.
I've tested the form and can see that it now works for some cases with this fix. Though there are some cases when button Save Changes doesn't get enabled when we change something, see demo video:
- When we select
DeploymentinWork needed. - When we select
Web BrowserinDevices.
|
|
||
| isChanged() { | ||
| return !!this.props.project.isDirty | ||
| return !!this.state.isProjectDirty |
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.
@gets0ul I guess when we are making this change, we don't use isDirty which we update inside Redux store, so I have a couple of questions:
- Should we still have and update
isDirtyin the Redux store? - Do you think it's safe to use
isProjectDirtyinstead ofisDirtyfrom the Redux store?
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.
isDirty from Redux is still used.
That is where the initial value of isProjectDirty come from.
Both will always have same value most of the time.
The only time they can be different is for the cases I already mentioned here #3175 (comment)
When a node is updated and the hidden value is still there.
When an option is selected and the default value is set.
isDirty will stay true when that option is deselected because of that hidden default value.
That's the only time, the value of isProjectDirty will be different.
I think it is safe as we have already been using the state isProjectDirty when creating SpecSection component to render the questions.
|
That's the correct behavior. The save button won't be enabled until we enter the value, |
|
Sorry for the delay with review @gets0ul. Today we are releasing the new version of Connect app. Will review this PR tomorrow. |
| // project's name might contain ampersand | ||
| if (key === 'name') { | ||
| return _.escape(srcValue) | ||
| } |
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.
@gets0ul I'm not sure what is the reason for adding this code, is there any situation when it helps?
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.
It is for the case like this https://connect.topcoder-dev.com/projects/7977/scope
when a project contains ampersand on it's name.
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.
@gets0ul this fix works good to me.
I've just added one comment above to clarify the code.
maxceem
left a comment
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.
Thanks, @gets0ul
I did testing several times because logic is quite tricky here but couldn't find any issues.
#3149