[OBPIH-6613] Fix localization on reasonCode label during pick#4782
[OBPIH-6613] Fix localization on reasonCode label during pick#4782awalkowiak merged 1 commit intodevelopfrom
Conversation
|
@kchelstowski @alannadolny @drodzewicz can you please look over this change and help me figure out a proper solution? What I have now in this PR fixes the issue but I don't know enough about how the frontend works to know if this is the correct approach. I'm also not sure why this error is only happening now since I don't see any recent code change being made here so if you have thoughts I'd be happy to hear them. |
| label: 'react.stockMovement.reasonCode.label', | ||
| defaultMessage: 'Reason code', | ||
| attributes: { | ||
| className: 'mb-2', |
There was a problem hiding this comment.
do I need to move the "ml-3 text-center" className values here?? I'm a frontend baby 👶
There was a problem hiding this comment.
if you moved it, it would be applied to the SelectField (the wrapper around the label element), not to the label itself, so let's skip it, as it's only a small margin that is not even noticeable.
| <Translate id="react.stockMovement.reasonCode.label" defaultMessage="Reason code" /> | ||
| </label> | ||
| ), | ||
| label: 'react.stockMovement.reasonCode.label', |
There was a problem hiding this comment.
@ewaterman I took a quick look to find a potential reason for that to be broken just now.
The bug is a bit deeper, hence I am not surprised you had some difficulties in even finding a "make it work" solution.
It got broken by this change: f55ed0d#diff-1f44efd686996ca77c130f21050ac254054b889fdd02d38b562605191318babbR49
We pass a function to the translate, when it expects us to pass a string. For this particular case, we don't provide the ariaLabel prop, so we have a fallback to: translate(FieldLabel, defaultMessage).
I can see that this is the only place where our label is a method, so I am fine with this change, but I am not sure if this <label> element didn't have some "hidden" behavior for this field, but I assume not (even if it had, we would still wrap this field around <label>, as it is wrapped in the form-utils.jsx 73th line.
| label: 'react.stockMovement.reasonCode.label', | ||
| defaultMessage: 'Reason code', | ||
| attributes: { | ||
| className: 'mb-2', |
There was a problem hiding this comment.
if you moved it, it would be applied to the SelectField (the wrapper around the label element), not to the label itself, so let's skip it, as it's only a small margin that is not even noticeable.
✨ Description of Change
Link to GitHub issue or Jira ticket: https://pihemr.atlassian.net/browse/OBPIH-6613
Description: There is currently an error on obdev3 (can replicate locally) where we're unable to manually pick items during outbound stock movements since it shows a blank screen when the button is pressed. The EditPickModal is failing to create due to errors localizing reasonCode. This change is to fix that.
📷 Screenshots & Recordings (optional)
https://jam.dev/c/dfc2213e-1b6b-4759-ba9b-c2b8da34790a
📈 Test Plan
Description of test plan (if applicable): Follow the steps in the JAM session and make sure the pick modal loads correctly (no more blank screen).
✅ Quality Checks
[OBS-123]for Jira,[#0000]for GitHub, or[OBS-123, OBPIH-123]if there are multiple), or with[N/A]if not applicable