-
Notifications
You must be signed in to change notification settings - Fork 12
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
Expose internal.ts to public to easily extend EntityState using same logic #212
Comments
@AM4Apps Today, full attention is paid to the new project and plugin: I'm not sure when work on the |
I check the data plugin. I guess it works like a data-service, so you need to subscribe yourself if you want to perform the "Action"(method call). ¿Right? How it will look a FechAll method in the state like this: public fetchAll(): Observable<any> {
return this.apiService.fetchAll()
.pipe(
tap((array) => this.setEntitiesAll(array))
);
} And after you will need to subscribe in the component, ¿Right? |
yes |
There's one more thing, ¿how you deal in the ngxs-labs/data plugin with circular dependencies? If i am not mistaken you should inject other states to call their methods or to join data from multiple states. State A => Call State B method(Action) or State A selector get data from State B |
please create stabcklitz example |
Whould be easier with a more specific model: export interface IAuthorDTO {
avatar?: string;
bornDate?: Date;
idLocation?: number;
id?: number;
name?: string;
}
export interface ILocationDTO {
authorsIds?: number[];
city?: string;
country?: string;
id?: number;
}
What i am trying is:
And the other way:
Result
With the action aproach this is not a problem because you will dispatch actions, and you will not have the state as depency. |
With the action aproach this is not a problem because you will dispatch actions, and you will not have the state as depency. here I will not help you with anything, use native NGXS But in general, if you were to use even regular services (rxjs statefull) instead of NGXS, this is a bad approach to have circular dependencies |
Ok thanks, i thought that. I was checking to work with normalized data with NGXS similar to this Akita Normalized Data |
I generalize some CRUD operations extending the ngxs-labs/entity-state plugin.
It's easy to extend this library, but i would like to use internal.ts methods so i don't need to copy them in my application.
Also i hope to get a Stable release soon available on NPM. 😉
The text was updated successfully, but these errors were encountered: