ngneat / reactive-forms

(Angular Reactive) Forms with Benefits 😉

Home Page:https://www.netbasal.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GetRawValue() doesn't return nested disabled values

jingfee opened this issue · comments

Is this a regression?

Yes

Description

I recently tried to update from 1.7.5 to 3.1.3 and found a bug within my application which I could trace down to getRawValue() not working as intended.

Examples when it works and doesn't work. the children-formarray is disable in these cases. For simplicitys sake the formgroups in these examples are visualized as json-objects.

This one works:

{
 "value": "foo",
 "children": [
  {
   value: "bar"
  }
 ]
}

This one doesn't work:

[
 {
  "value": "foo",
  "children": [
   {
    value: "bar"
   }
  ]
 }
]

In the second example I only get the "value: 'foo'" when calling getRawValue() and the children-formarray is completely missing. Downgrading back to 1.7.5 and it works as expected again.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

Share your code, please.

Share your code, please.

I'm trying to replicate in a Stackblitz 🙂

Here is a Stackblitz showing the issue. https://stackblitz.com/edit/angular-ivy-yfgasi. It is currently configured to use 3.1.3 and as you can see, the childQuestions-array is not present when using getRawValue(). If you remove the .disable() at row 22, or change to 1.7.5 in package.json, you can see the childQuestions being printed out.