-
Notifications
You must be signed in to change notification settings - Fork 402
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
Entity Adapter #56
Comments
Yes, it would be nice. Entity adapter gives more comfortable things to manipulate with storage. |
I am switching over from NGRX where I heavily used the NGRX Entity modules. Would love to see something like this implemented for NGXS. |
Closing and marking for future. |
How far in the future is the entity adapter planned for? This is the only reason why I’m hesitating to switch. The feeling sucks because I can’t wait to switch. |
Is there a provision for such an appeal? I'd love to see this in NGXS |
When patching your state instead of just using the array of values (data) use:
In ngrx-data they also have an array of id's, so you could add that as well.
|
I have created a LIB to be used as follows. I'm using it on mine. How to use: export class UserStateModel extends NgxsEntityStateModel<UserModel> {}
@State<UserStateModel>({
name: 'user',
defaults: UserStateModel.InitialState()
})
export class UserState implements NgxsOnInit {} Methods Available: NgxsEntityStateModel Class: export class NgxsEntityStateModel<T> {
public ids: string[];
public entities: { [id: string]: T };
public selected: T | null;
public isLoading: boolean;
static InitialState() {
return {
ids: [],
entities: {},
selected: null,
isLoading: false
};
}
} |
@abalad I would love to see what this lib looks like! |
Is only a class with static methods for now, but I want to do better integration within NGXS: Example: https://gist.github.com/abalad/d9c82af8bcdce904bb173a7e1fe3edaa Lib: |
A proposal for entity through decorator: #580 |
A while back I prototyped something like John Papas NGRX-DATA, https://gist.github.com/amcdnl/cafd37bc9a99e2cd7653ebc023e06ffe#file-readme-md
Something we might want to think about one day.
The text was updated successfully, but these errors were encountered: