odata2ts / odata2ts

Flexible generator to produce various TypeScript artefacts (from simple model interfaces to complete odata clients) from OData metadata files
https://odata2ts.github.io/
MIT License
92 stars 12 forks source link

Support AbortSignal in options for FetchClient #276

Closed brandonryan closed 3 weeks ago

brandonryan commented 4 months ago

add signal?: AbortSignal to FetchRequestConfig to allow clients to cancel requests.

Right now in my react application, when a filter changes, but a request is in flight, I have no way to cancel the old request. Adding this feature would solve that problem.

texttechne commented 4 months ago

Hi @brandonryan, nice point, signal will be added to: https://github.com/odata2ts/http-client/blob/main/packages/fetch/src/FetchRequestConfig.ts#L9

Actually, it's "only" the typing of the fetch request options that is over-restrictive. So you can pass any valid fetch request config including the signal property. Just @ts-ignore it for now as workaround.

texttechne commented 1 month ago

Solved with release @odata2ts/http-client-fetch@0.8.0.

Please test and close this issue if successful.

brandonryan commented 2 weeks ago

Oops, missed this. Yes it is fixed. thank you!