-
Notifications
You must be signed in to change notification settings - Fork 400
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃殌[FEATURE]: UpdateFormValue not working properly on FormArray #910
Comments
I have the same issue, I believe this was not fixed. I have an In ngxs devtools I noticed that update action is triggered twice or three times without an extra action from my side. in the first update action the form is updated with the values properly. then another update value is triggered again automatically that removes the array of 3 items and set it to one item in the array. |
@MurhafSousli could you create a minimal reproducible example, please? |
Though this isn't the original issue of the OP, we are currently also having a similar issue as described by @MurhafSousli Basically, if you have a form array which represents an array in the store and then update that array with ctx.patchState(newArray) via a store action - then the new value will be immediately deleted from the store after the action is completed You can see this behaviour in the following stackblitz: What we would like to achieve is that you click the button which updates the array in the state and for every entry in the array a new input is shown. But if you click the button, an action is correctly triggered which updates the array in the store, but there are no new form controls in the form. If you inspect the store via Redux plugin, you can see that the custom action updates the store, but immediatly afterwards the store is updated again by the [FORM] actions and the array is removed: @arturovt Is there a way to achieve the desired behaviour without losing the array? |
hey @splincode, since this ticket is already closed. could you check @Melechoris reply and reopen the ticket? |
The forms plugin has been great thus far, and then I've run into this issue with |
The array objects are not acceptable for angular I'm all up for fixing it so it works automatically, but I don't see a way forward. Ngxs is unaware of all additional parameters that are passed to angular forms while angular's built-in |
Closing this issue because:
If anybody comes up with a decent proposal, please feel free to open a new issue to discuss the proposal. |
I'm submitting a...
Current behavior
When trying to use the UpdateFormValue command over an array index (included in a form group) using the path 'names.list.0' then the value is appended to the root form group instead of actually updating the array, please check the following Stackblitz:
https://stackblitz.com/edit/ngxs-forms-updateformvalue-nested-array-error
Expected behavior
The command should update the FormControl properly, interestingly when using the FormArray directly as root state, the command works properly, please check this Stackblitz for the working version:
https://stackblitz.com/edit/ngxs-forms-updateformvalue-nested-array-error-lemcra
Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/ngxs-forms-updateformvalue-nested-array-error
1- Click on update name to execute the command.
Environment
The text was updated successfully, but these errors were encountered: