Skip to content
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) O3-3547: Handle possibly undefined encounter.obs in LabResultsForm #1903

Conversation

PiusKariuki
Copy link
Contributor

@PiusKariuki PiusKariuki commented Jul 8, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR fixes an issue in the LabResultsForm component where clicking the Add results button from the OrderDetails table overflow menu would sometimes fail to successfully launch the form.

To remedy this, I've tweaked the logic so that the code that sets obsUuid and isEditing is in a useEffect hook. This ensures that we only try to access encounter.obswhen it is available and not undefined. I've also moved the logic for fetching initial values into a separate useEffect hook that depends on isEditing and obsUuid.

Screenshots

Related Issue

LINK TO JIRA TICKET

Other

@PiusKariuki
Copy link
Contributor Author

@brandones Please help me review this PR.

@denniskigen denniskigen requested a review from pirupius July 8, 2024 13:12
@pirupius
Copy link
Member

pirupius commented Jul 8, 2024

Thanks @PiusKariuki for this. Did you test this with lab sets?

@PiusKariuki
Copy link
Contributor Author

PiusKariuki commented Jul 8, 2024 via email

Copy link
Member

@pirupius pirupius left a comment

Choose a reason for hiding this comment

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

Is there work that hasn't been committed yet? The video recording in your PR description shows it's working but i've pulled your branch and it has the same error

Screenshot 2024-07-09 at 08 43 25
Screen.Recording.2024-07-09.at.08.40.24.mov

@PiusKariuki
Copy link
Contributor Author

@pirupius I have not experienced this behaviour let me test it again then I'll ping you on slack

@denniskigen denniskigen force-pushed the fix/add-results-action-error-on-the-lab-orders branch from d4b2730 to 679a4f7 Compare July 9, 2024 17:54
@denniskigen denniskigen changed the title fix: "add results" action error on the lab orders #O3-3547 (fix) O3-3547: Handle possibly undefined encounter.obs in LabResultsForm Jul 9, 2024
@denniskigen denniskigen merged commit c3a736d into openmrs:main Jul 10, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants