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

Support exporting an async function from contact-summary.templated.js #9623

Open
jkuester opened this issue Nov 6, 2024 · 0 comments
Open
Labels
Type: Feature Add something new

Comments

@jkuester
Copy link
Contributor

jkuester commented Nov 6, 2024

Is your feature request related to a problem? Please describe.
Currently the contact-summary.templated.js config file exports an object containing the contact summary config. The current contact, reports, and lineage are provided to this code as global context, but there is no way to perform async operations to build the contact summary config object.

The CHT api (which is just cht-datasource under the hood) is also currently available to contact summary config code. However, none of the async functions can currently be used since there is no way to await the results.

This situation makes it impossible to support more advanced logic in the contact summary config (such as looking up the children of the current contact).

Describe the solution you'd like

Instead of directly exporting the contact summary config object, it would be nice to support exporting an async function that, in turn, would resolve the contact summary config object. Naturally, this functionality could be abused in any number of ways that could result in poor performance of the contact summary calculation, but this would be config-dependent and by default the performance would be no worse than how things are now.

Describe alternatives you've considered

If we do not have any support for async calls in the contact summary code, it would mean that any additional data we want to expose to the contact summary calculations would have to be pre-loaded each time a contact summary is calculated. For example, some deployments might want to have logic based on the children of the current contact. Currently, the only option for including this in the contact-summary is to update the cht-core code to always look up the children for every contact when loading the contact summary (regardless of whether that data is actually used. Taking things one step further, consider the likelihood that perhaps you only want to look up the children of certain contact types?!? For cases like these, pre-loading the data becomes very painful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Add something new
Projects
None yet
Development

No branches or pull requests

1 participant