fix: compute suffixes for the entire layout not per axis and refactor#306
Open
HendrikThePendric wants to merge 1 commit into
Open
fix: compute suffixes for the entire layout not per axis and refactor#306HendrikThePendric wants to merge 1 commit into
HendrikThePendric wants to merge 1 commit into
Conversation
|
🚀 Deployed on https://pr-306.event-visualizer.netlify.dhis2.org |
|
edoardo
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Implements DHIS2-21682
Description
Summary
Dimension chip suffixes were computed per axis, so two same-named dimensions on different axes (e.g. the same data element from two stages, one in Columns and one in Filters) showed no disambiguating suffix. Suffixes now consider the whole layout.
The fix exposed that the suffix mechanism and the layout helpers it leans on had grown awkward, so this also reshapes them.
Changes
Suffix bug fix
Suffix mechanism
modules/dimension/suffix.tsgetDimensionSuffixes(dimensions, getName)with two pure building blocks:buildSuffixContext({ programs, programStages })(counts, name maps, stage-name collisions — computed once) andgetDimensionSuffix(dimension, context)(pure per-dimension lookup). The rules are unchanged.Layout hooks
use-layout-dimensions.tsuseLayoutDimensions()returns dimensions grouped per axis ({ columns, rows, filters }), soAxesno longer regroups.Axistakes finished dimensions instead of ids.useDimensionSuffix(id)provides the modal's single title suffix.Layout context consolidation
modules/layout.ts+hooks/resolveProgramIds/resolveProgramStageIds/resolveTetIdand theiruseProgramIds/useProgramStageIds/useTetIdhooks with a singleresolveLayoutContext(ids, store)→{ programIds, programStageIds, tetId }and auseLayoutContext()hook. Migrated all call sites (action buttons, custom value, cross-TET, drag-and-drop, plugin).useLayoutContextrecomputes only when the layout changes.resolveLayoutContextthrows on a dimension missing from the store rather than silently skipping.Plugin (line-list headers)
buildHeadersuses the new suffix API andresolveLayoutContext. Program/stage names come from the metadata store (populated bysetVisualizationMetadatain both app and plugin).Quality checklist
Screenshots
Cross axis comparison in action
