Skip to content

Conversation

JayadityaGit
Copy link
Contributor

Requirements

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.

Summary

This PR introduces two main changes:

  1. Redirect on First Visit

    • Adds a redirect from /home/service-queues to /root on the first visit.
    • Uses a hasBeenRedirected flag in sessionStorage to ensure it only happens once per session.
    • Registered in src/index.ts with a new route in src/routes.json.
  2. Random Patient Getter

    • Updates the patient getter to fetch a random patient instead of a hardcoded one.
    • usePatient hook (src/patient-getter/patient-getter.resource.ts) now fetches 100 patients and selects one at random.
    • Button text updated from Get a patient named 'test' to Get a random patient in patient-getter.component.tsx.
  3. Error Safeguard

    • Added validation in patient-getter.component.tsx to check patient name formatting before rendering.
    • Prevents script errors if the selected patient is missing data or removed from the database.

Screenshots

None


Related Issue

[Jira Ticket: O3-5010](https://issues.openmrs.org/browse/O3-5010)


Other

None

- Add a redirect from /home/service-queues to /root on first visit
- Modify patient getter to fetch a random patient instead of a hardcoded one
@JayadityaGit
Copy link
Contributor Author

Hi @denniskigen 👋,

I’ve opened this PR which introduces two changes:

Adds a redirect from /home/service-queues to /root on the first visit (handled via a sessionStorage flag to ensure it only happens once per session).

Updates the patient getter to fetch a random patient instead of a hardcoded one, with a safeguard to prevent errors if patient data is incomplete.

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.

1 participant