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

[FEAT] Add a dataprovider using KY #6381

Open
capsloq opened this issue Sep 30, 2024 · 5 comments
Open

[FEAT] Add a dataprovider using KY #6381

capsloq opened this issue Sep 30, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@capsloq
Copy link
Contributor

capsloq commented Sep 30, 2024

Is your feature request related to a problem? Please describe.

Most data providers use of Axios which is considered deprecated by (many/some). See adios-axios. Nowadays Native Fetch APIs are widely supported by all big browsers. A thin wrapper like KY provides an easy API to make use of functionalities like interceptors.

Describe alternatives you've considered

No response

Additional context

Axios was once a convenient library that utilized XMLHttpRequest in web browsers and the http module in Node environments. However, in today's modern development landscape, this approach has been surpassed by the native Fetch API, which offers consistent functionality across browsers, Node, and even other environments.

With the adoption of a unified API like Fetch, you can easily eliminate Axios as an additional dependency in your modern codebase, resulting in reduced bundle sizes. Moreover, the Fetch API has undergone full standardization, unlike Axios, which comes with its own set of nuances that often catch developers off-guard. This includes differences in how fetch and Axios handle promise rejection in various scenarios.

Furthermore, certain frameworks, like Next.js, have begun exposing additional features within the Fetch API that may not be readily accessible when using Axios.

Discussion was started here:
#6375 (reply in thread)

Issue was opened for better tracking.

Describe the thing to improve

Add ky support @refinedev/simple-rest/ky
Once the simple-rest-ky provider is implemented it might be used as a blueprint for upcoming providers e.g. Strapi 5

@capsloq capsloq added the enhancement New feature or request label Sep 30, 2024
@BatuhanW
Copy link
Member

BatuhanW commented Oct 1, 2024

@capsloq thanks for the issue. About exposing it as @refinedev/simple-rest/ky, you can check our nextjs-router package. We have @refinedev/nextjs-router/app and also @refinedev/nextjs-router/pages exports separately.

https://github.com/refinedev/refine/blob/master/packages/nextjs-router/package.json

@OmkarBansod02
Copy link
Contributor

hey @BatuhanW , I am working on adding the KY data provider to the @refinedev/simple-rest package. I’ve created a new provider-ky.ts file that mirrors the existing Axios provider, but uses the KY HTTP client for requests. will create a pull request soon. Let me know if you have any feedback or suggestions!

@kfern
Copy link

kfern commented Nov 30, 2024

@OmkarBansod02 Nice! I can help with testing if you want

@OmkarBansod02
Copy link
Contributor

@kfern Yeah sure! i have open a PR. once go through it.

@BatuhanW BatuhanW removed good first issue Good for newcomers up for grabs labels Dec 5, 2024
@BatuhanW
Copy link
Member

BatuhanW commented Dec 5, 2024

We will update the issue with more details about the implementation we want after discussing with the core team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants