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

dhis2: fix upsert anti pattern behavior #1049

Closed
hunterachieng opened this issue Mar 11, 2025 · 1 comment
Closed

dhis2: fix upsert anti pattern behavior #1049

hunterachieng opened this issue Mar 11, 2025 · 1 comment
Assignees

Comments

@hunterachieng
Copy link
Contributor

Issue Description

Currently in dhis2's upsert function, http.get() is directly called inside the function and we have to pass state to it directly. This is an anti-pattern behaviour that we need to fix.

This is the current implementation:

 promise = http
        .get(
          resourceType,
          query,
          options
        )(state)

See comment for reference: #1046 (comments)

@hunterachieng hunterachieng self-assigned this Mar 11, 2025
@github-project-automation github-project-automation bot moved this to New Issues in v2 Mar 11, 2025
@josephjclark
Copy link
Collaborator

The fix is to use something like utill.request to do the http stuff for us without the operation overhead. As we do in most adaptors.

Where this gets tricky is that we're using axios in this adaptor. Does it still make sense to have a util.request written in axios? If we're going to have to refactor axios code, are we better off just swapping axios out and doing this all at once?

I keep changing my mind on the axios stuff. I had talked myself out of it last week. This week I think we may have to take the hit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants