-
Notifications
You must be signed in to change notification settings - Fork 2
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
UIBULKED-605 Enabling Confirm changes button based on forms state #679
Conversation
const isAdministrativeFormPristine = !isEqual(ADMINISTRATIVE_FORM_INITIAL_STATE, contentUpdates); | ||
const isMarcFormPristine = !isEqual(MARC_FORM_INITIAL_STATE, marcContentUpdatesWithoutId); | ||
|
||
// state is valid if at least one form is filled and valid and another one is not pristine or both forms are filled and valid |
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.
I think you meant to say in the comment that another one is pristine
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.
I'm with @BogdanDenis here, but I feel like both the comment AND the conditional contradict the PR description which states "2 valid forms, or 1 valid and one untouched". Here, you instead check 2 valid forms or 1 valid and one NOT pristine. Or do you have the booleans on lines 57 and 58 configured backwards, i.e. isPristine
should be true when those values are equal, instead of when they differ?
Super petty: since your comment describes two different scenarios, just put them on two different lines. As-is, it's hard to parse how the ands and ors separate things.
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.
I don't feel like the PR description and the code are aligned. Can you confirm?
const isAdministrativeFormPristine = !isEqual(ADMINISTRATIVE_FORM_INITIAL_STATE, contentUpdates); | ||
const isMarcFormPristine = !isEqual(MARC_FORM_INITIAL_STATE, marcContentUpdatesWithoutId); | ||
|
||
// state is valid if at least one form is filled and valid and another one is not pristine or both forms are filled and valid |
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.
I'm with @BogdanDenis here, but I feel like both the comment AND the conditional contradict the PR description which states "2 valid forms, or 1 valid and one untouched". Here, you instead check 2 valid forms or 1 valid and one NOT pristine. Or do you have the booleans on lines 57 and 58 configured backwards, i.e. isPristine
should be true when those values are equal, instead of when they differ?
Super petty: since your comment describes two different scenarios, just put them on two different lines. As-is, it's hard to parse how the ands and ors separate things.
# Conflicts: # CHANGELOG.md
@zburke @BogdanDenis the variables actually had unnecessary inversions of values. I updated the PR description, and divided the variables into more meaningful parts. Please double check. |
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.
This is much clearer. Thank you! I think the comment is still not quite right, but I'll let you decide.
src/components/BulkEditPane/BulkEditMarcLayer/BulkEditMarcLayer.js
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
Based on the new requirements, it is necessary to activate/deactivate the "Confirm changes" button based on the state of the forms.
Previously, a scenario was possible in which the user filled out one of the forms completely, and one partially. In this situation, the frontend made it possible to submit forms, but cut off partially filled forms and send default values.
After this PR is merged, the "Confirm changes" button will be enabled only in 3 cases:
Details:
Refs: UIBULKED-605