Skip to content

feat: organisation-unit-tree to support shortname (DHIS2-21561)#1745

Merged
KaiVandivier merged 2 commits into
masterfrom
feat/organisation-unit-tree-support-shortname
May 26, 2026
Merged

feat: organisation-unit-tree to support shortname (DHIS2-21561)#1745
KaiVandivier merged 2 commits into
masterfrom
feat/organisation-unit-tree-support-shortname

Conversation

@janhenrikoverland
Copy link
Copy Markdown
Contributor

@janhenrikoverland janhenrikoverland commented May 26, 2026

Ref this subtask: https://dhis2.atlassian.net/browse/DHIS2-21561

Adds a displayProperty prop to OrganisationUnitTree so consumers can render labels with displayShortName instead of displayName.

Context: DHIS2 has a keyAnalysisDisplayProperty system/user setting that the analytics apps (data-visualizer, line-listing, dashboards) already plumb through @dhis2/analytics's OrgUnitDimension as displayNameProp. That dead-ended at the tree though, since there was no matching prop on this side. This PR is the missing piece.

Both useDataQuery calls use the field-rename trick when a non-default displayProperty is passed:

  • root: ${displayProperty}~rename(displayName)
  • children: children[id,path,${displayProperty}~rename(displayName)]

When displayProperty is the default 'displayName', the field strings stay byte-identical to before, so the wire format and existing mocks are unchanged. The internal node shape always exposes .displayName, so no render-side code moves and existing callers see no difference. Fully backwards compatible.

@dhis2/analytics still needs a small change to actually forward displayProperty through OrgUnitDimension, but that's a separate PR.

Also fixed two pre-existing react-hooks/exhaustive-deps warnings in use-org-children.js that CI surfaced once the file was in the diff (node.children missing from useMemo, node missing from useEffect). Both effects already guard against unwanted re-runs, so behavior is unchanged.

Checklist

  • API docs are generated (auto-generated from propTypes)
  • Tests were added. N/A Existing assertions are ok.
  • Storybook demos were added. N/A Not needed.

@dhis2-bot
Copy link
Copy Markdown
Contributor

dhis2-bot commented May 26, 2026

🚀 Deployed on https://pr-1745--dhis2-ui.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify May 26, 2026 09:14 Inactive
@sonarqubecloud
Copy link
Copy Markdown

@dhis2-bot dhis2-bot temporarily deployed to netlify May 26, 2026 09:34 Inactive
@janhenrikoverland janhenrikoverland marked this pull request as ready for review May 26, 2026 11:45
@janhenrikoverland janhenrikoverland requested a review from a team as a code owner May 26, 2026 11:45
@janhenrikoverland janhenrikoverland changed the title feat: organisation-unit-tree to support shortname feat: organisation-unit-tree to support shortname (DHIS2-21561) May 26, 2026
@KaiVandivier KaiVandivier merged commit 447d3db into master May 26, 2026
21 checks passed
@KaiVandivier KaiVandivier deleted the feat/organisation-unit-tree-support-shortname branch May 26, 2026 15:25
dhis2-bot added a commit that referenced this pull request May 26, 2026
# [10.16.0](v10.15.1...v10.16.0) (2026-05-26)

### Features

* **organisation-unit-tree:** add displayProperty prop to support shortname (DHIS2-21561) ([#1745](#1745)) ([447d3db](447d3db))
@dhis2-bot
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 10.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants