Skip to content

🌟 v2

Compare
Choose a tag to compare
@parkerziegler parkerziegler released this 04 Aug 01:08
· 84 commits to main since this release

This release includes full support for BuckleScript 7 and widely reorganizes reason-urql to be more modular and easier to contribute to. Most of the public API has stayed the same, with some exceptions (documented below).

Users who upgrade to v2 should be on BuckleScript 7, as this library relies heavily on direct record to object compilation.

Added

  • All hooks and Client.execute* methods that accepted a partial operation context argument now accept each key of the operationContext record type as an optional function argument. For example, you can now write code like this:
open ReasonUrql;

/* Define query to execute. */
let subscription = Client.executeQuery(~query, ~requestPolicy=`CacheFirst, ~pollInterval=200, ());

reason-urql will handle compiling each argument and passing it along to urql properly.

  • Interface files (.rei) were added for all modules.
  • The stale flag is now returned on all results returned by reason-urql hooks, which indicates that the result returned by the hook is stale and that another request is being sent in the background. This is particularly useful with the `CacheAndNetwork request policy.

Changed

  • The response variant now has 5 constructors – Fetching, Data(d), PartialData(d, e), Error(e), and Empty. You can read more about each of these here.
  • The UrqlTypes module is now just Types.
  • The Exchanges module is now a sub-module of the Client module. Once ReasonUrql is brought into scope it can be refrenced as Client.Exchanges.
  • ssrExchange now accepts ssrExchangeParams as its first labeled argument, not ssrExchangeOpts. ssrExchangeParams is also a record type while ssrExchangeOpts was a [@bs.deriving abstract]. This brings it more in line with urql's implementation.
  • serializedResult is now a record type rather than a [@bs.deriving abstract].
  • The signature of exchanges has changed to properly support uncurrying syntax.
type t =
  exchangeInput =>
  (. Wonka.Types.sourceT(UrqlClientTypes.operation)) =>
  Wonka.Types.sourceT(UrqlClientTypes.operationResult);
  • Local binding of graphQLError is now a record type rather than a [@bs.deriving abstract] and has its own module GraphQLError.

Removed

  • Component bindings for Query, Mutation, Subscription, and SubscriptionWithHandler were removed. Just use the hooks APIs!
  • Client methods for executeRequestOperation, reexecuteOperation, createRequestOperation, and dispatchOperation were removed. These are no longer in urql's public facing API.

Diff

v1.7.0...v2.0.0