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

Getting error when I have a dependency and a required array inside of a oneOf. #2898

Closed
andmoredev opened this issue Jun 24, 2021 · 3 comments
Labels

Comments

@andmoredev
Copy link
Contributor

Description
I have nested objects with a few dependencies in those objects. Whenever an inner object has dependencies making a field rquired based on another one having a value and if the object is required by the parent it throws an error

Error: [Formly Error] [Expression "templateOptions.required"] Cannot read property 'middleName' of undefined

It's going to be easier to see it than to explain it with words.

Minimal Reproduction
https://stackblitz.com/edit/issue-with-v21?file=src%2Fapp%2Fapp.component.ts

In the example if you remove the required array on line 67 the error goes away or if you remove the dependencies in line 62 it works. It's something about that combination that is making it break.

When it's broken you can see that the radio button doesn't actually change the fields that correspond to the value in the oneOf, when it works you can see the fields change when you change the option.

Your Environment

  • Angular version: 10.2.5
  • Formly version: 5.10.21

Additional context
We don't have these problems when running version 5.10.18, when we tried to upgrade to 5.10.21 our application became unusable because of this.
I did some testing and this issue starts showing on version 5.10.19

@andmoredev andmoredev added the bug label Jun 24, 2021
@andmoredev
Copy link
Contributor Author

andmoredev commented Jun 25, 2021

I think the issue might have been introduced by this commit:

28e7def

@andmoredev
Copy link
Contributor Author

Thanks for looking into this @aitboudad. Do you have an idea of when the next minor version of the npm package will be release?

Thank you!

@aitboudad
Copy link
Member

This issue has been fixed and released as part of v5.10.22 release.

Please let us know, in case you are still encountering a similar issue/problem.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants