Writer & Editor
Sorry, there is no results for this query
The good news is that it involves only minimal changes to the API, so updating should take less than ten minutes: Upgrade Guide.
In this article, we’ll highlight some of the main advances in this brand new version.
Our new client comes packed with new features; yet, despite these additions, it’s actually smaller compared to v3:
That amounts to a combined 64% size decrease compared to the previous version. With this decrease, your page loads faster.
Also, we’ve reduced the number of dependencies from 15 to 0. Yes, that’s right – 0 dependencies. So we no longer take the risk of receiving third-party updates that might break the client.
To provide the best developer experience, we’ve added a bunch of new helpers that aren’t just a simple mapping to API endpoints. Users are now able to `replaceAllObjects` with zero downtime, or `copyIndex` between apps, and many other such multi-task operations! Here are some examples:
For optimal developer experience and type safety, the new client is fully written in TypeScript. Thanks to this, the developer will be able to leverage optional static typing and type inference out of the box.
Just like v3, we ship with two versions: lite and default – these are predefined versions that help developers get started quickly using the traditional: “algoliasearch(appId,apiKey)”.
Now, thanks to a brand new architecture, you can build your own version of the client, adapted to your needs. Here is an example:
With this approach, developers can inject their own requester and logger, as well as their own cache implementations. Good news is that, even if you inject your concrete implementations, everything still runs under our retry strategy.
We believe this modularity helps developers meet the demands of more advanced use cases.
See something that needs to be improved? Just send us a pull request on GitHub. Thanks! And we hope you enjoy this new release! 🎉