🌟 v2
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 theoperationContext
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 allmodules
. - The
stale
flag is now returned on all results returned byreason-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)
, andEmpty
. You can read more about each of these here. - The
UrqlTypes
module is now justTypes
. - The
Exchanges
module is now a sub-module of theClient
module. OnceReasonUrql
is brought into scope it can be refrenced asClient.Exchanges
. ssrExchange
now acceptsssrExchangeParams
as its first labeled argument, notssrExchangeOpts
.ssrExchangeParams
is also a record type whilessrExchangeOpts
was a[@bs.deriving abstract]
. This brings it more in line withurql
'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 moduleGraphQLError
.
Removed
- Component bindings for
Query
,Mutation
,Subscription
, andSubscriptionWithHandler
were removed. Just use the hooks APIs! Client
methods forexecuteRequestOperation
,reexecuteOperation
,createRequestOperation
, anddispatchOperation
were removed. These are no longer inurql
's public facing API.