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

"visibleIf" with nothing vs. "oneOf" #445

Open
KBroichhausen opened this issue Jul 21, 2022 · 0 comments
Open

"visibleIf" with nothing vs. "oneOf" #445

KBroichhausen opened this issue Jul 21, 2022 · 0 comments

Comments

@KBroichhausen
Copy link
Contributor

I have an object Object 2 which only should be visible if:
Field 1 is equal to value Value 1
or Field 2 is equal to value 1.

Now, add some extra: Field 2 is only visible if Field 1 is equal to Value 2 or Value 3.

This simply means that Object 2 is mandatory for Value 1 and is optional for Value 2 and Value 3, which can be toggled via Field 2.

Sounds too complicated...here is a stackblitz: https://stackblitz.com/edit/angular-ivy-ymrftk

As you can see, Schema 1 contains oneOf for Object 2 in visibleIf and is rendered without Object 2 and Schema 2 does not contain oneOf but Object 2 is rendered.
If you flip-flop in Schema 1 to e.g. Value 2 and back to Value 1, you are back at initial state but now Object 2 is visible.

This does not look like it is intended. I would create a PR but currently I do not know why there is different logic for oneOf and without oneOf because I thought this should be equivalent in my case.
It looks like the not visible element in the oneOf part triggers the setVisible method with false.

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

No branches or pull requests

1 participant