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

defaultValue: null - Cannot read property 'parent' of undefined #2491

Closed
damsorian opened this issue Sep 8, 2020 · 9 comments
Closed

defaultValue: null - Cannot read property 'parent' of undefined #2491

damsorian opened this issue Sep 8, 2020 · 9 comments
Labels

Comments

@damsorian
Copy link

damsorian commented Sep 8, 2020

Description
In the version 5.10.1 when the defaultValue is null the ngx-formly-core.js breaks

I think the problem is this logic changed related to the defaultValue v5.10.0...v5.10.1#diff-9b2d3151ef7629725cd42759a64296adR99

handle-error.service.ts:51 TypeError: Cannot read property 'parent' of undefined
    at assignFieldValue (ngx-formly-core.js:92)
    at CoreExtension.initFieldOptions (ngx-formly-core.js:3299)
    at CoreExtension.onPopulate (ngx-formly-core.js:3199)
    at ngx-formly-core.js:719
    at Array.forEach (<anonymous>)
    at FormlyFormBuilder._buildForm (ngx-formly-core.js:715)
    at ngx-formly-core.js:725
    at Array.forEach (<anonymous>)
    at FormlyFormBuilder._buildForm (ngx-formly-core.js:721)
    at ngx-formly-core.js:725

Minimal Reproduction

Only set a defaultValue to null in any component

I don't know why I can't reproduce the issue on stackblitz but in local with a minimal stack, it throws that error and breaks the app

Your Environment

  • Angular version: 10.1.0
  • Formly version: 5.10.1
@damsorian damsorian added the bug label Sep 8, 2020
@aitboudad
Copy link
Member

could you please provide a reproduction example, thanks!

@damsorian damsorian changed the title DefaultValue null breaks ngx-formly-core.js defaultValue: null - Cannot read property 'parent' of undefined Sep 8, 2020
@damsorian
Copy link
Author

@aitboudad I don't know why I can't reproduce the issue on stackblitz but in local with a minimal stack, it throws the error Cannot read property 'parent' of undefined

I think the problem is this logic changed related to the defaultValue v5.10.0...v5.10.1#diff-9b2d3151ef7629725cd42759a64296adR99

@aitboudad
Copy link
Member

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

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

@damsorian
Copy link
Author

gracias!!

@miko-engr
Copy link

miko-engr commented Feb 24, 2021

@aitboudad - I am experiencing similar issue on my end with data-table integration. Just added a screenshot for reference.
image Please let me know if you have any solution for it. Thanks!

@aitboudad
Copy link
Member

@miko-engr I think there is a bug somewhere but I need a reproduction scenario/example 🙏 in order to fix it also make sure you're using the latest version of Formly.

@bandman0226
Copy link

bandman0226 commented Mar 24, 2022

I am getting the same issue. I am trying to use the latest next version with primeng. It happens when clicking the datepicker.
https://stackblitz.com/edit/ngx-formly-flex-layout-6ksvaw?file=src%2Fapp%2Fapp.component.ts

@aitboudad
Copy link
Member

@bandman0226 the mentioned stackblitz is working for me, could you please check it again or maybe I'm missing something 🤔.

@bandman0226
Copy link

bandman0226 commented Mar 25, 2022

My apologies. It was not working but I got it working after messing with the stackblitz for the datepicker code from the formly site. There were some things missing to run the demo code for that datepicker in stackblitz so I fixed the same on the original one I had trouble with.

Thanks again for taking the time to look at it!

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

4 participants