Skip to content

Conversation

@DiogoABastos
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation
  • Other... Please describe:

What is the current behaviour? (You can also link to an open issue here)
https://hyland.atlassian.net/browse/AAE-39988

What is the new behaviour?

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

@sonarqubecloud
Copy link

@alep85 alep85 requested a review from Copilot November 14, 2025 09:58
Copilot finished reviewing on behalf of alep85 November 14, 2025 10:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes dropdown conditional functionality within repeatable sections by ensuring that field IDs and rule references are properly transformed when fields are cloned for each row of a repeatable section.

Key Changes

  • Refactored ID assignment logic into a dedicated getId() helper method that returns the parent's unique ID when a parent exists
  • Added getRule() method to transform rule references for repeatable section children by updating the ruleOn property to point to the correct row-specific field ID
  • Introduced getRepeatableSectionChildRuleOn() to append the row suffix to rule references

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
lib/core/src/lib/form/components/widgets/core/form-field.model.ts Refactored field ID and rule assignment logic into separate helper methods to handle repeatable section parent context
lib/core/src/lib/form/components/widgets/core/form-field.model.spec.ts Added test data with conditional dropdowns and test cases to verify ID and rule transformations for repeatable section widgets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +292 to +308
private getId(id: string, parent?: RepeatableSectionModel): string {
return parent ? parent.uid : id;
}

private getRule(rule: FormFieldRule, parent?: RepeatableSectionModel): FormFieldRule {
return rule && parent
? ({
...rule,
ruleOn: this.getRepeatableSectionChildRuleOn(rule.ruleOn)
} as FormFieldRule)
: rule;
}

private getRepeatableSectionChildRuleOn(ruleOn: string) {
return ruleOn + ROW_ID_PREFIX + this.id.split(ROW_ID_PREFIX)[1];
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the responsibility about the rule can be handled by a new class that deal only with that. e.g. form-field-rule-handler.ts, or form-field-rule-processor.ts
This class is already a bit busy, shifting this logic to a dedicated class would keep responsibilities nicely separated

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