-
Notifications
You must be signed in to change notification settings - Fork 248
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
(refactor) Switch visit requests to use promises instead of observables #2073
Conversation
Ports over requests to the Visit API to use promise-based fetch requests instead of observables. Promises are generally simpler to work with than observables, and this should make the code easier to understand. This change also makes the code more consistent with other requests the frontend makes to the REST API. I've also amended the `UpdateVisitPayload` type annotation to a partial of `NewVisitPayload`, as not all fields are required when updating a visit. We should only really need to provide the stop datetime when ending a visit, for example.
Size Change: -44.5 kB (-0.28%) Total Size: 15.8 MB
ℹ️ View Unchanged
|
mutateCurrentVisit(); | ||
mutateVisits(); | ||
mutateInfiniteVisits(); |
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.
Can we make these 3 mutates outside of the if
conditions since they are related to the core visit form itself?
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.
@vasharma05 Let's move that to it's own ticket.
Requirements
Summary
Related to and dependent on openmrs/openmrs-esm-core#1184.
Ports over requests to the Visit API to use promise-based fetch requests instead of observables. Promises are generally simpler to work with than observables, and this should make the code easier to understand. This change also makes the code more consistent with other requests the frontend makes to the REST API.
I've also amended the
UpdateVisitPayload
type annotation to a partial ofNewVisitPayload
, as not all fields are required when updating a visit. We should only really need to provide the stop datetime when ending a visit, for example.Screenshots
Related Issue
Other