-
Notifications
You must be signed in to change notification settings - Fork 1
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
A few component adjustments (mostly Asthma related). #217
Conversation
…ey submissions enough time to process setting the custom field.
@@ -58,7 +58,7 @@ export default function (props: AsthmaActionPlanManagerProps) { | |||
setDeviceInfo(deviceInfo); | |||
}); | |||
|
|||
loadActionPlan(); | |||
setTimeout(loadActionPlan, 500); |
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.
I feel slightly obligated to explore this a bit, since I think we all know that setTimeout
as a solution to a problem always feels a little awkward since it doesn't really guarantee anything. In the PR Description you mention a custom field that's not yet updated - how is that update occuring? Being a little less familiar with the overall Asthma flow and only looking at the widgets in the storybook it's not very clear.
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.
Yep, for sure. I am not real fond of it either, but I'm not sure how else to solve it.
Here is what appears to be happening on Android:
- User visits a view that contains the
AsthmaActionPlanManager
. AsthmaActionPlanManager
queries for the participant and finds an emptyAAPTaskRunUUID
custom field. It displays the "Tap to add photo" button.- User taps to add a photo and the image capture survey gets launched.
- User completes the image capture survey, which has a web view step that populates the
AAPTaskRunUUID
custom field with the task run UUID for that survey submission. - The
AsthmaActionPlanManager
comes back to the foreground and re-queries for the participant to check for a new value in theAAPTaskRunUUID
custom field. - About 50% of the time during my testing, the
AAPTaskRunUUID
custom field was not yet populated when theAsthmaActionPlanManager
returned to the foreground and the reload occurred.
I assumed the survey submission loading indicator would remain in the foreground until all custom fields were updated as part of the survey submission, but some part of it must be asynchronous, or the survey submission loading indicator screen on Android must be closing before it completes.
Adding this slight delay to the loading seems to allow enough time to pass for the custom field to always be populated.
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.
I'm going to tinker around with using the surveyDidFinish
event instead of the applicationDidBecomeVisible
event to see if that behaves more like I want it to. If so, I'll revert this change. 😃
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.
@ajmenca - Thanks for the nudge on this. It has the desired behavior when I use the surveyDidFinish
event instead. I was able to remove the setTimeout(...)
.
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.
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.
For the record, here's how it works in the iOS app. First, the app uploads the survey task result. After completing that API request, it triggers a few events simultaneously and asynchronously:
- Uploading any auxiliary files (e.g. Active Task data files)
- Refresh the app UI
- Post surveyDidFinish and applicationDidBecomeVisible JS SDK events
The web content receives those SDK events ±10 milliseconds after the survey task upload API request completes. surveyDidFinish is received first, and immediately afterward (less than a millisecond) applicationDidBecomeVisible.
Overview
This branch contains three bug fixes.
The Asthma Action Plan Manager now waits a half second before loading the action plan to give any survey submissions the necessary time to update the task run UUID custom field appropriately. On Android, we noticed that, occasionally, the custom field was not yet updated when the component attempted to reload the AAP.
The HR and SpO2 charts on the Asthma Heart and Lung view have been updated to round all values to the nearest whole number rather than displaying decimal values.
The "no data" state for the recent daily data bar chart has been updated to handle larger font sizes.
Security
REMINDER: All file contents are public.
Describe briefly what security risks you considered, why they don't apply, or how they've been mitigated.
Checklist
Testing
Documentation
n/a