-
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
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 |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ import { | |
| } from '../../config/constants' | ||
| import _ from 'lodash' | ||
| import update from 'react-addons-update' | ||
| import { clean } from '../../helpers/utils' | ||
|
|
||
| const initialState = { | ||
| isLoading: true, | ||
|
|
@@ -631,13 +632,18 @@ export const projectState = function (state=initialState, action) { | |
| if (key === 'screens' || key === 'features' || key === 'capabilities') { | ||
| return srcValue// srcValue contains the changed values from action payload | ||
| } | ||
|
|
||
| // project's name might contain ampersand | ||
| if (key === 'name') { | ||
| return _.escape(srcValue) | ||
| } | ||
|
Collaborator
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. @gets0ul I'm not sure what is the reason for adding this code, is there any situation when it helps?
Contributor
Author
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. It is for the case like this https://connect.topcoder-dev.com/projects/7977/scope |
||
| } | ||
| ) | ||
| // dont' compare this properties as they could be not added to `projectNonDirty` | ||
| // or mutated somewhere in the app | ||
| const skipProperties = ['members'] | ||
| const clearUpdatedProject = _.omit(updatedProject, skipProperties) | ||
| const clearUpdatedNonDirtyProject = _.omit(state.projectNonDirty, skipProperties) | ||
| const skipProperties = ['members', 'invites'] | ||
| const clearUpdatedProject = clean(_.omit(updatedProject, skipProperties)) | ||
| const clearUpdatedNonDirtyProject = clean(_.omit(state.projectNonDirty, skipProperties)) | ||
| if (!_.isEqual(clearUpdatedProject, clearUpdatedNonDirtyProject)) { | ||
| updatedProject.isDirty = true | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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
isDirtywhich we update inside Redux store, so I have a couple of questions:isDirtyin the Redux store?isProjectDirtyinstead ofisDirtyfrom the Redux store?Uh oh!
There was an error while loading. Please reload this page.
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.
isDirtyfrom Redux is still used.That is where the initial value of
isProjectDirtycome 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.
isDirtywill staytruewhen that option is deselected because of that hidden default value.That's the only time, the value of
isProjectDirtywill be different.I think it is safe as we have already been using the state
isProjectDirtywhen creatingSpecSectioncomponent to render the questions.