gabrielguerrero / ngrx-traits

NGRX Traits is a library to help you compose and reuse state logic in your angular app. There is two versions, @ngrx-traits/signals supports ngrx-signals, and @ngrx-traits/{core, common} supports ngrx.
MIT License
44 stars 3 forks source link

Allow factory config in withEntitiesLoadingCall #95

Closed gabrielguerrero closed 1 month ago

gabrielguerrero commented 1 month ago

Allow an alternative way of using withEntitiesLoadingCall, that receives a factory function like with withCalls, this has the advantage of allowing us to use the store in the onSuccess and onError example

withEntitiesLoadingCall(({ entitiesPagedRequest, entitiesFilter, se }) => ({ fetchEntities: async () => { const res = await lastValueFrom( inject(BranchService).getBranches({ search: entitiesFilter().search, skip: entitiesPagedRequest().startIndex, take: entitiesPagedRequest().size, }), ); return { entities: res.resultList }; }, onSuccess: ({ entities }) => { // call the store signals.computed or methods or patchState } })),

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 17.7.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: