-
Notifications
You must be signed in to change notification settings - Fork 46
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
fix(ocrvs-5086): show different label when father address matches #183
fix(ocrvs-5086): show different label when father address matches #183
Conversation
Allow passing array of conditionals, create helper
@Zangetsu101 @rikukissa Just to clarify the discussion we had earlier:
I could not find a simple way to change the label as suggested. Let me know if I missed something. |
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 changes look good! It's better this way than to handling the form label & review label separately. One other thing, although it's not mentioned in the ticket, in death form we also have a similar case for informant & spouse if I'm not wrong. They should have a field like "place of residence same as deceased". Let's add the conditionals for them as well please!
fields: SerializedFormField[], | ||
conditionalCase: string | Conditional[] | ||
) { | ||
fields.forEach((field) => { |
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.
Was there some other mutation happening on a higher level that forced this function also to mutate the inner array values?
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 will check! I opted for caution if there was some performance reason for mutating.
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.
If you see code with side effects in our codebase you can safely assume it's either:
- Something higher in the call stack is built using mutation and the author didn't have time to fix the root issue
- Side-effectful code got past code review unnoticed
We advocate for immutable values and anything else should be a rare exception
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.
Clear! On this particular case, We are mutating on higher levels. Taking into account the 1.5. delivery, I suggest I'll merge this one after the new changes have been reviewed and check whether I could get rid of the mutations.
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.
Looks good 👍
🍒 Merge changes from PR #183 to release-v1.5.0
Show matching label depending on father's primary address selection.
conditionalCase
type, allow passingConditional[]
I could not get to a nicely working solution without utilising the
Conditional
type. I opted for not trying to modify theprimaryAddress
previewGroup
since it was much more involved.Let me know what you think.
I left a todo comment which I intend to fix if you find the approach ok.