Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAE-24018 Readonly dropdown with the rest config don't fetch options when form rule change it to not readonly #9959

Merged

Conversation

wiktord2000
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)
AAE-24018

Screen.Recording.2024-07-18.at.13.32.02.mov

Note: We have form rule here: Enable dropdown when Text field has '1', otherwise is disabled.

What is the new behaviour?

Screen.Recording.2024-07-18.at.13.32.42.mov

Note: We have form rule here: Enable dropdown when Text field has '1', otherwise is disabled.

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:

@wiktord2000
Copy link
Contributor Author

wiktord2000 commented Jul 18, 2024

Note: With the current code is difficult to call api only when field is not readonly by the applied rule (it would be ideal I guess), so the call is done at the form init even the dropdown is readonly at that time.

@wiktord2000
Copy link
Contributor Author

wiktord2000 commented Jul 18, 2024

The actual issue refers to cloud widgets but I guess I have to update regular ones as well, I can remove the changes if I'am mistaken (dropdown.widget.* files)

@kathrine0
Copy link
Contributor

Note: With the current code is difficult to call api only when field is not readonly by the applied rule (it would be ideal I guess), so the call is done at the form init even the dropdown is readonly at that time.

Can't we track the readonly value change and query the api only then? Why is it not possible?

@wiktord2000
Copy link
Contributor Author

Note: With the current code is difficult to call api only when field is not readonly by the applied rule (it would be ideal I guess), so the call is done at the form init even the dropdown is readonly at that time.

Can't we track the readonly value change and query the api only then? Why is it not possible?

After small investigation, we relay on @input() field from inherited component class -> WidgetComponent, and readonly state is determined by field.readOnly property (when this rule will be fulfilled this value will change), I tried to use ngOnChanges hook on that but seems that we still relay on the same reference hence we can't track its changes. The benefit of current implementation is that we always call once when we will call every time readonly has changed it could lead to multiple api calls, which are not needed

@wiktord2000 wiktord2000 force-pushed the fix/AAE-24018-readonly-dropdown-in-not-readonly-form branch from 16d4a14 to 75378a7 Compare July 26, 2024 07:39
@wiktord2000 wiktord2000 force-pushed the fix/AAE-24018-readonly-dropdown-in-not-readonly-form branch from 5fde186 to 6a8306c Compare July 30, 2024 14:27
Copy link

sonarcloud bot commented Jul 30, 2024

@wiktord2000 wiktord2000 merged commit 72ea94e into develop Jul 31, 2024
33 checks passed
@wiktord2000 wiktord2000 deleted the fix/AAE-24018-readonly-dropdown-in-not-readonly-form branch July 31, 2024 07:38
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.

2 participants