silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
195 stars 19 forks source link

Remove axios from `DataProviderApi` base class and refactor axios error handling #1694

Closed axelboc closed 3 months ago

axelboc commented 3 months ago

In this PR, I'm finally removing the cancellableFetchValue method from the DataProviderApi base class. This method made little sense ever since the arrival of h5wasm, which doesn't require making HTTP requests at all.

This should get rid of axios from consumer bundles that use H5WasmBufferProvider or H5WasmLocalFileProvider. It also means that if we expose DataProviderApi in the future, consumers may be able to develop their own network-based provider without having to use axios as the fetching library.

So it's now up to H5GroveProvider and HsdsProvider to initialise and use their own axios client. I had to refactor axios error handling a bit to make this a bit more palatable, but overall I find the result less convoluted than before. I especially like that the DataProviderApi base class no longer has any method implementations.