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

WithCalls store every result in the state #62

Closed francobasilico closed 2 months ago

francobasilico commented 2 months ago

WithCalls feature is great for making the request and tracking status, errors and result.

WithCalls allows me to use onSuccess to manipulate the result But what if I don't want to store the whole result of the call?

Is there any way I can ignore storing the result and just get the benefit of the tracking status/errors?

withCalls(
    (store, dataService = inject(WebCoreDataAccessService), downloadService = inject(FileDownloaderService)) => ({
      downloadInvoice: {
        call: ({ id, fileName }: { id: string; fileName: string }) => {
          downloadService.downloadFile(`${environment.api}/invoicing/${id}`, fileName);
          return of(true);
        },

        mapPipe: 'switchMap',
      },
    }),
  ),

In this example downloadInvoice is an operation that doesn't generate result

github-actions[bot] commented 2 months ago

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

The release is available on:

Your semantic-release bot :package::rocket: