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

Forms: better handling of internal onCollectionChange callbacks #39732

Open
AndrewKushnir opened this issue Nov 18, 2020 · 0 comments
Open

Forms: better handling of internal onCollectionChange callbacks #39732

AndrewKushnir opened this issue Nov 18, 2020 · 0 comments
Assignees
Labels
area: forms breaking changes P4 A relatively minor issue that is not relevant to core functions
Milestone

Comments

@AndrewKushnir
Copy link
Contributor

Form controls have internal API that allows subscribing to changes in a data collection of FormGroups and FormArrays (when a new control is added to a collection or existing one is removed). This internal API is used inside FormGroupDirective to trigger DOM updates. The problem with the current API is that there is no way to append a callback or remove a particular one (for ex. a callback that belongs to a directive that is being removed). Instead, new onCollectionChange callback always resets existing one.

We should consider updating the logic that handles onCollectionChange callback to provide an ability to add and remove
particular callbacks without affecting previous callbacks, similar to what we have for onChange callbacks. That should help implement more granular management of the onCollectionChange callbacks.

Note: this change would be backwards-incompatible since some exiting code may rely on the fact that the onCollectionChange callback is getting rewritten. There is a PR #39685 that implements the change proposed in this ticket.

@AndrewKushnir AndrewKushnir added breaking changes area: forms P4 A relatively minor issue that is not relevant to core functions labels Nov 18, 2020
@AndrewKushnir AndrewKushnir self-assigned this Nov 18, 2020
@ngbot ngbot bot added this to the Backlog milestone Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: forms breaking changes P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

1 participant