You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+111Lines changed: 111 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,117 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
8
+
## [3.0.0] - 2020-11-14
9
+
10
+
This release migrates us to using `@reasonml-community/graphql-ppx` as our GraphQL PPX preprocessor of choice in lieu of `@baransu/graphql_ppx_re`. It also converts `urql` to a `peerDependency` of the library rather than bundling `urql` as a direct dependency. Finally, this release includes support for BuckleScript / ReScript > 8.0.0.
11
+
12
+
### Changed
13
+
14
+
-`urql`, along with its own `peerDependencies`, should be installed alongside `reason-urql`, which no longer bundles `urql` as a direct dependency. See updated installation instructions in the README. PR by @parkerziegler[here](https://github.com/FormidableLabs/reason-urql/pull/224).
15
+
- Users should install `@reasonml-community/graphql-ppx` as a `peerDependency` of `reason-urql`.
16
+
- Users depending on `bs-platform>=8.0.0` will need to specify a resolution for `wonka` v5 using [yarn resolutions](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/). See updated installation instructions in the README.
17
+
-`Client.execute*` methods underwent four major API changes:
18
+
19
+
1. There is no longer a `~request` labelled argument. Instead, the GraphQL operation is passed using `~query` for `Client.executeQuery`, `~mutation` for `Client.executeMutation`, and `~subscription` for `Client.executeSubscription`. This applies to `Client.query`, `Client.mutation`, `Client.subscription`, and `Client.readQuery` as well.
20
+
2. GraphQL operations are passed as [first-class modules](https://dev.realworldocaml.org/first-class-modules.html) to `Client.execute*` methods. This means you pass your entire GraphQL query `module` as a function argument, like so:
21
+
22
+
```reason
23
+
open ReasonUrql;
24
+
25
+
module GetAllDogs = [%graphql {|
26
+
query getAllDogs {
27
+
dogs {
28
+
name
29
+
breed
30
+
likes
31
+
}
32
+
}
33
+
|}];
34
+
35
+
/* Pass GetAllDogs as a first-class module to Client.executeQuery. */
3. Variables are passed as the last positional argument to `Client.execute*` methods, if they are required. PR by @parkerziegler[here](https://github.com/FormidableLabs/reason-urql/pull/226). We interface with `@reasonml-community/graphql-ppx` to typecheck your `variables` based on the signature of your GraphQL operation. If your query, mutation, or subscription requires variables, pass them as a record in the last position, like so:
40
+
41
+
```reason
42
+
open ReasonUrql;
43
+
44
+
module GetDog = [%graphql {|
45
+
query getDog($key: ID!) {
46
+
dog(key: $key) {
47
+
name
48
+
breed
49
+
likes
50
+
}
51
+
}
52
+
|}];
53
+
54
+
/* Pass GetDog as a first-class module to Client.executeQuery,
55
+
with required variables as a record in the final position. */
4. The `response` variant for `Client.execute*` methods was renamed to `operationResponse` and should be referenced from the `Types` module rather than the `Client` module.
60
+
61
+
- The hooks APIs underwent three major API changes:
62
+
63
+
1. There is no longer a `~request` labelled argument. Instead, the GraphQL operation is passed using `~query` for `useQuery`, `~mutation` for `useMutation`, and `~subscription` for `useSubscription`.
64
+
2. GraphQL operations are passed as [first-class modules](https://dev.realworldocaml.org/first-class-modules.html) to each hook. This means you pass your entire GraphQL query `module` as a function argument, like so:
65
+
66
+
```reason
67
+
open ReasonUrql;
68
+
69
+
module GetAllDogs = [%graphql {|
70
+
query getAllDogs {
71
+
dogs {
72
+
name
73
+
breed
74
+
likes
75
+
}
76
+
}
77
+
|}];
78
+
79
+
[@react.component]
80
+
let make = () => {
81
+
/* Pass GetAllDogs as a first-class module to useQuery. */
82
+
let (Hooks.{response}, _) = Hooks.useQuery(~query=(module GetAllDogs), ());
83
+
84
+
/* Return the JSX for your component. */
85
+
}
86
+
```
87
+
88
+
3. Variables are passed as the last positional argument to a hook, if they are required. PR by @amiralies[here](https://github.com/FormidableLabs/reason-urql/pull/225). We interface with `@reasonml-community/graphql-ppx` to typecheck your `variables` based on the signature of your GraphQL operation. If your query, mutation, or subscription requires variables, pass them as a record in the last position, like so:
89
+
90
+
```reason
91
+
module GetDog = [%graphql {|
92
+
query getDog($key: ID!) {
93
+
dog(key: $key) {
94
+
name
95
+
breed
96
+
likes
97
+
}
98
+
}
99
+
|}];
100
+
101
+
[@react.component]
102
+
let make = () => {
103
+
/* Pass GetDog as a first-class module to useQuery,
104
+
with required variables as a record in the final position. */
105
+
let (Hooks.{response}, _) = Hooks.useQuery(~query=(module GetDog), {key: "12345"});
106
+
107
+
/* Return the JSX for your component. */
108
+
}
109
+
```
110
+
111
+
### Removed
112
+
113
+
- The `useDynamicMutation` hook was removed. `useMutation` now consolidates the former use case for this hook and brings our APIs more inline with how `urql` works.
This release is the first release candidate for v3.0.0, which will use `@reasonml-community/graphql-ppx` as our PPX preprocessor for GraphQL operations. Breaking changes will be listed in the release notes for the first stable release of v3.0.0.
### 1. Install `reason-urql`and its `peerDependencies`.
31
+
### 1. Install `reason-urql`alongside its `peerDependencies` and `devDependencies`.
32
32
33
33
```sh
34
34
yarn add reason-urql urql graphql
35
+
yarn add gentype --dev
35
36
```
36
37
37
38
We try to keep our bindings as close to latest `urql` as possible. However, `urql` tends to make releases a bit ahead of `reason-urql`. To get a compatible version, we recommend always staying strictly within this project's `peerDependency` range for `urql`.
38
39
40
+
The `gentype``devDependency` is a requirement introduced by `urql`'s use of `wonka`. `wonka`'s source uses `@genType` declarations, so when the BuckleScript / ReScript compiler attempts to compile `wonka` in your project, it'll need a local copy of `gentype` to use.
41
+
39
42
#### 1a. **Important note for users of `bs-platform>=8.0.0`**.
40
43
41
44
If using `bs-platform>=8.0.0` you'll need to use [`yarn resolutions`](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/) to specify a specific version of `wonka` to resolve. `urql` has an explicit dependency on latest `wonka``v4`, which is incompatible with `bs-platform>=8.0.0`. See [this issue](https://github.com/kitten/wonka/issues/85) for more details.
0 commit comments