arthur-fontaine / agrume

Server-side functions in your frontend for any tool. Easy, customizable and type-safe. Made for frontend developers.
https://agrume.js.org
MIT License
9 stars 0 forks source link

New feature: optimized client #79

Open arthur-fontaine opened 2 months ago

arthur-fontaine commented 2 months ago

Currently, the client is duplicated each time createRoute is used. To prevent this duplication, we can create a new package named @agrume/optimized-client. This package will export an optimizedClient that would simply be a short way to global.__agrumeClient, and a side-effect that will assign the default client to global.__agrumeClient. This side-effect should be imported in the main.tsx (or similar, basically the root/entry point), and the optimizedClient could either be utilized in the global config, or in the options of the createRoute function.