Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Aug 8, 2024

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.

packages/app/src/ErrorFallback.tsx Show resolved Hide resolved
packages/app/src/ErrorFallback.tsx Show resolved Hide resolved
packages/app/src/providers/api.ts Show resolved Hide resolved
packages/app/src/providers/utils.ts Show resolved Hide resolved
packages/app/src/providers/utils.ts Show resolved Hide resolved
@axelboc axelboc requested a review from loichuder August 8, 2024 13:56
packages/app/src/providers/utils.ts Outdated Show resolved Hide resolved
packages/app/src/providers/utils.ts Outdated Show resolved Hide resolved
Base automatically changed from progress-store to main August 20, 2024 15:14
@axelboc axelboc merged commit cb4ef80 into main Aug 21, 2024
8 checks passed
@axelboc axelboc deleted the refact-api branch August 21, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants