Skip to content

[OBPIH-6613] Fix localization on reasonCode label during pick#4782

Merged
awalkowiak merged 1 commit intodevelopfrom
bug/OBPIH-6613-unable-to-pick-manually
Aug 13, 2024
Merged

[OBPIH-6613] Fix localization on reasonCode label during pick#4782
awalkowiak merged 1 commit intodevelopfrom
bug/OBPIH-6613-unable-to-pick-manually

Conversation

@ewaterman
Copy link
Member

@ewaterman ewaterman commented Aug 12, 2024

✨ Description of Change

A concise summary of what is being changed. Please provide enough context for reviewers to be able to understand the change and why it is necessary. If the issue/ticket already provides enough information, you can put "See ticket" as the description.

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)

If this PR contains a UI change, consider adding one or more screenshots here or link to a screen recording to help reviewers visualize the change. Otherwise, you can remove this section.

https://jam.dev/c/dfc2213e-1b6b-4759-ba9b-c2b8da34790a


📈 Test Plan

We require that all code changes come paired with a method of testing them. Please select which of the following testing approaches you've included with this change:

  • Frontend automation tests (unit)
  • Backend automation tests (unit, API, smoke)
  • End-to-end tests (Playwright)
  • Manual tests (please describe below)
  • Not Applicable

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

Please confirm and check each of the following to ensure that your change conforms to the coding standards of the project:

  • The pull request title is prefixed with the issue/ticket number (Ex: [OBS-123] for Jira, [#0000] for GitHub, or [OBS-123, OBPIH-123] if there are multiple), or with [N/A] if not applicable
  • The pull request description has enough information for someone without context to be able to understand the change and why it is needed
  • The change has tests that prove the issue is fixed / the feature works as intended

@ewaterman ewaterman self-assigned this Aug 12, 2024
@github-actions github-actions bot added type: bug Addresses unintended behaviours of the app domain: frontend Changes or discussions relating to the frontend UI labels Aug 12, 2024
@ewaterman
Copy link
Member Author

@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',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do I need to move the "ml-3 text-center" className values here?? I'm a frontend baby 👶

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@awalkowiak awalkowiak merged commit 17bb958 into develop Aug 13, 2024
@awalkowiak awalkowiak deleted the bug/OBPIH-6613-unable-to-pick-manually branch August 13, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI type: bug Addresses unintended behaviours of the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants