The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
There is a risk of race condition between form instances; for example, the webapp loads a pregnancy form, then loads a pregnancy follow-up form (by changing the URL); the pregnancy form may have a delay and ends up calling the service to unload after the pregnancy follow up was loaded. The unload function has code that affected the pregnancy follow up form.
These race conditions are rare but can still happen. If we fix this, then maintenance and extensibility will be easier.
Describe the improvement you'd like
Extract the form's instance-specific code out of the Enketo Service. The service receives the form instance and executes support operations like extracting data for saving, fetching and setting attachments, etc.
Operations over a form instance shouldn't affect another form instance.
A form instance has a clear life cycle that the implementing page can control.
Describe the issue
Currently,
webapp
can only display one Enketo form at a time; the enketo service is doing form's instance jobs like unloading a form, setup form's buttons, force a form recalculation, etc.There is a risk of race condition between form instances; for example, the webapp loads a pregnancy form, then loads a pregnancy follow-up form (by changing the URL); the pregnancy form may have a delay and ends up calling the service to unload after the pregnancy follow up was loaded. The unload function has code that affected the pregnancy follow up form.
These race conditions are rare but can still happen. If we fix this, then maintenance and extensibility will be easier.
Describe the improvement you'd like