🌟 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 theoperationContextrecord 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
staleflag is now returned on all results returned byreason-urqlhooks, 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
responsevariant now has 5 constructors –Fetching,Data(d),PartialData(d, e),Error(e), andEmpty. You can read more about each of these here. - The
UrqlTypesmodule is now justTypes. - The
Exchangesmodule is now a sub-module of theClientmodule. OnceReasonUrqlis brought into scope it can be refrenced asClient.Exchanges. ssrExchangenow acceptsssrExchangeParamsas its first labeled argument, notssrExchangeOpts.ssrExchangeParamsis also a record type whilessrExchangeOptswas a[@bs.deriving abstract]. This brings it more in line withurql's implementation.serializedResultis 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
graphQLErroris now a record type rather than a[@bs.deriving abstract]and has its own moduleGraphQLError.
Removed
- Component bindings for
Query,Mutation,Subscription, andSubscriptionWithHandlerwere removed. Just use the hooks APIs! Clientmethods forexecuteRequestOperation,reexecuteOperation,createRequestOperation, anddispatchOperationwere removed. These are no longer inurql's public facing API.