satanTime / ngrx-entity-relationship

ORM selectors for redux, @ngrx/store, @ngrx/entity and @ngrx/data. Ease of relationships with entities.

Home Page:https://ngrx-entity-relationship.sudo.eu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add the transform feature to related selectors

satanTime opened this issue · comments

The goal is to have possibility to convert entities on all levels.

I'm also interested in this. Has any progress been made?

I've implemented a mediocre solution with two large downsides:

  • I didn't make an effort to add multiple signatures to relatedEntity and relatedEntitySelector with the new transformer option. I defined an additional relatedEntityWithTransformer with its matching relatedEntitySelectorWithTransformer. They are typed with an additional type parameter TRANSFORMED_RELATED_ENTITY, some occurrences of RELATED_ENTITY in the type definitions have been replaced with TRANSFORMED_RELATED_ENTITY. Once everything works, it would be much better to have a unique function to call, but I'm not sure what's the best design for this.
  • It works well for one level of relations, but not for nested relations. I think this has to do with the caching process in relatedEntity's callback, which I probably don't exploit adequately.

I've also tried something similar with childrenEntities.

I'm not happy with my current solutions but I'm of course willing to share them, especially if that helps with the development of a better alternative.