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

Will ngrx-forms be part of official NGRX project? #105

Closed
dankerk opened this issue Aug 23, 2018 · 5 comments
Closed

Will ngrx-forms be part of official NGRX project? #105

dankerk opened this issue Aug 23, 2018 · 5 comments

Comments

@dankerk
Copy link

dankerk commented Aug 23, 2018

Surely this question has been raised before somewhere.
In my case I really want to use ngrx-forms in a few projects at the (big) company I work for. Most of us here would like to use it and see the benefits. But because this is not part of the official ngrx project it's being seen as too big of a risk to use it throughout all apps.

Are there or where there every any plans to make ngrx-forms part of the official ngrx project? And what is the current status of these plans?

Thanks for all your good work so far :)

@fxck
Copy link

fxck commented Aug 24, 2018

Nope.

Read ngrx/platform#431 and ngrx/core#12

What they plan to do is some sort of bridge between angular reactive forms and ngrx (or something like that), they think that keeping forms state in a store is a bad idea.

@MrWolfZ
Copy link
Owner

MrWolfZ commented Aug 26, 2018

Indeed, as @fxck said the ngrx team is against putting form state into the store and therefore this library will most likely never become part of the ngrx project.

@MrWolfZ MrWolfZ closed this as completed Aug 26, 2018
@MrWolfZ
Copy link
Owner

MrWolfZ commented Aug 26, 2018

Let me add though that the dependency of this library on ngrx itself is almost non-existant. Even the Angular parts aren't that big. And this library has only peer dependencies, no direct dependencies on anything else. Therefore personally I consider it to be low risk since the probability of compatibility issues of this with ngrx is very very low.

@dankerk
Copy link
Author

dankerk commented Aug 27, 2018

Thanks for the comments.
It would be nice if they created some sort of bridge between reactive forms and ngrx. @fxck Do you know if they have some kind of timeline on that? It seems a bit quiet in the to topics you mentioned.

I suppose their argument against having form state in the store would be that most part of the form state can be computed based on just the form values. But if you have a form error notification that you display based on the validity of a form field, then I feel like it would justify having the error state of that field in the store as it would represent the state of the application, no?

So what if instead of having the entire form state in the store, you would be able to configure ngrx-forms to put only the form properties in the store that you actually use (and have the rest as internals)?
In this way you would be able to define for example to only have the value property of your form in the store, and add the other properties (controls, isSubmitted, etc.) to the store only when you need them.

Perhaps this would take away some of the objections some people may have against this library.

@fxck
Copy link

fxck commented Aug 27, 2018

I don't think that bridge between ngrx and reactive forms will be enough, unless reactive forms undergo refactoring, which I doubt, reactive forms are clunky and not really that reactive.

I get where they are coming from not wanting to keep form state in store, but at the same time I find it extremely useful most of the time. If you are using ngrx ecosystem (effects particularly), you are gonna have a problem doing even simple things such as resetting form state (and submitted state, which is not even stored in the Form* classes but on NgForm directive instead).

I haven't worked with this lib nearly enough (started a new project few days ago, decided to give it a try) but I find it a little bit clunky, but it's a solid foundation, so I started writing abstractions around it, which so far worked fine. I'll try to give some relevant feedback once I've worked with it bit more.

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

No branches or pull requests

3 participants