Skip to content

[fix]: Update org unit parameter changes in v42#387

Merged
Ramon-Jimenez merged 6 commits into
developmentfrom
fix/tracker-data-population-v42
Jun 10, 2026
Merged

[fix]: Update org unit parameter changes in v42#387
Ramon-Jimenez merged 6 commits into
developmentfrom
fix/tracker-data-population-v42

Conversation

@deeonwuli

@deeonwuli deeonwuli commented Mar 4, 2026

Copy link
Copy Markdown

📌 References

📝 Implementation

  • Refactored buildOrgUnitMode to check the api version and return the ou parameters correctly

🔥 Notes for the reviewer

📹 Screenshots/Screen capture

Screen.Recording.2026-03-04.at.17.08.34.mov

📑 Others

#869cb326m

@bundlemon

bundlemon Bot commented Mar 4, 2026

Copy link
Copy Markdown

BundleMon

No change in files bundle size

Groups updated (1)
Status Path Size Limits
Build Folder
./**/*
1.72MB (+209B +0.01%) +20%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@gqcorneby gqcorneby left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @deeonwuli! Just a minor comment

Comment thread src/data/Dhis2RelationshipTypes.ts Outdated
return { ouMode, orgUnit: buildOrgUnitsParameter(orgUnits) };
const orgUnitsParam = buildOrgUnitsParameter(majorVersion, orgUnits);
if (majorVersion >= 42) return { orgUnitMode: ouMode, orgUnits: orgUnitsParam };
else if (majorVersion === 41) return { ouMode: ouMode, orgUnit: orgUnitsParam };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the return for this is the same as the one in the else branch, we can remove this else if branch, right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right 👌

@deeonwuli deeonwuli requested a review from gqcorneby March 5, 2026 07:28

@gqcorneby gqcorneby left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good!

@deeonwuli deeonwuli requested a review from MatiasArriola March 24, 2026 10:47
@deeonwuli

Copy link
Copy Markdown
Author

I have added @MatiasArriola to review these changes as he suggested some improvements.

@MatiasArriola MatiasArriola left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the getVersion call is cached, getExistingTeis handles v42, and the !isOuReq condition is handled.

All of this was because I was evaluating the approach to support v42 in generic apps.
I think this PR is the most sensible short-term approach, until we have new releases of d2-api available.
Once we have d2-api ready to support these v42 changes, we could replace this implementation.

Thanks for the updates @deeonwuli !

- parseInt the minor component so pre-release suffixes (e.g. "2.44-SNAPSHOT")
  resolve to their major version instead of NaN, which would otherwise make
  buildOrgUnitMode silently fall back to the legacy v<42 OU params on SNAPSHOT/RC
  instances.
- Add unit tests for getMajorVersion and buildOrgUnitMode across v41/v42/SNAPSHOT.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@Ramon-Jimenez Ramon-Jimenez left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working great! Thanks @deeonwuli

@Ramon-Jimenez Ramon-Jimenez merged commit ad3b790 into development Jun 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants