Conversation
| maxHeight(px(200)), | ||
| overflow(`auto), | ||
| minWidth(px(300)), | ||
| maxWidth(px(500)) |
There was a problem hiding this comment.
I'm going to add a refmt pre-commit hook in soon to catch things like this!
db5ec38 to
fa60962
Compare
| ]; | ||
|
|
||
| Client.executeQuery(~client, ~query=queryRequest) | ||
| |> Wonka.subscribe((. response) => { |
There was a problem hiding this comment.
I'll flesh this example out more a bit later on. Right now, it just kicks off a mutation every 5 seconds so you can see the debugExchange working in the console.
| "codecov": "^3.3.0", | ||
| "coveralls": "^3.0.2", | ||
| "graphql": "^14.1.1", | ||
| "codecov": "3.2.0", |
There was a problem hiding this comment.
Still messing around trying to get Codecov working. I think it might be too messed up on the current project, so we'll retry with a new token when v1 is in a mergeable state.
| [@bs.module "urql"] external dedupExchange: exchange = ""; | ||
| [@bs.module "urql"] external fallbackExchangeIO: exchangeIO = ""; | ||
| [@bs.module "urql"] external fetchExchange: exchange = ""; | ||
| [@bs.module "urql"] external subscriptionExchange: exchange = ""; |
There was a problem hiding this comment.
Looking more closely, subscriptionExchange may differ slightly in API from the other exchanges. I'll circle back to these bindings in the next PR, which'll add tests!
There was a problem hiding this comment.
Yea that is a factory that takes some extra options
This PR adds support for exchanges 🎉, addressing #40. The bulk of the work went into typing all of the API surface that underpins exchanges, i.e.
operation,operationResult,operationType,operationContext,exchangeInput, andexchangeIO, but that was made much easier byurql's TS defs.A note on the architecture here – you'll see that
UrqlExchangesis amoduledefined withinUrqlClient. There's a reason for this. Exchanges acceptexchangeInputas their single parameter, which is an object composed offorward(a function for forwarding operations to the next exchange) andclient(the client instance, in this case of typeUrqlClient.t). Because of this pairing between the types for exchanges and the typetof the client, the modules have to be co-located or we get the cyclic dependency of death error.For example, if
UrqlExchangeswas its own module our dependency graph would look like:UrqlExchanges.exchangeInputreferencesUrqlClient.t.UrqlClientreferencesUrqlExchanges.exchangeas part of its config options.Co-locating makes sense here though, because exchanges are really only used by the client. If other folks have other organizational strategies, I'd love to hear them!