Skip to content

Conversation

@superskip
Copy link
Contributor

@superskip superskip commented Aug 6, 2025

DHIS2-19820

These changes targets section forms containing tracked entity attributes. The purpose is to enable program rule assignment of attributes that are part of the program, but not part of the section form. The technical solution here is to devise a special section for all such "rogue" elements, and have it be omitted from rendering (like in DHIS2-19604).

After implementing this, some issues with validation errors came up. The reason turned out to be twofold: First, there is a complete validation of the form itself when the form loads, and the new section did not take part in it. This has been corrected by always making the section hidden rather than excluding it completely from rendering. Second, the rule engine runs once while the form is loading, but at the end of this execution it did not validate the assign effects. Consequently the assigned attributes were treated as invalid until the rule engine was run a second time, by making a change in the form.

While scrutinizing how the form-loading call to the rule engine was implemented (in the profile widget), it turned out it got called more often than it was supposed to. Thus I added a simple stopping mechanism in useLifecycle as a remedy.

@superskip superskip requested a review from a team as a code owner August 6, 2025 13:23
@superskip superskip changed the title DHIS2-19820 fix: [DHIS2-19820] create special section for attributes not assigned to a section Aug 6, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 8, 2025

Copy link
Contributor

@simonadomnisoru simonadomnisoru left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

3 participants