rescript-relay 1.0.0-beta.16 → 1.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/package.json +7 -7
- package/relay-compiler-linux-musl/relay +0 -0
- package/relay-compiler-linux-x64/relay +0 -0
- package/src/ReactDOMExperimental.bs.js +3 -3
- package/src/ReactDOMExperimental.res +2 -3
- package/src/ReactExperimental.bs.js +14 -1
- package/src/ReactExperimental.res +9 -4
- package/src/ReactExperimental.resi +18 -0
- package/src/experimental-router/RescriptRelayRouter.bs.js +2 -1
- package/src/utils.js +4 -0
- package/src/utils.mjs +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# master
|
|
2
2
|
|
|
3
|
-
# 1.0.0-beta.
|
|
3
|
+
# 1.0.0-beta.19
|
|
4
4
|
|
|
5
5
|
_[Here's a commit showing a project being upgraded to this version](https://github.com/zth/rescript-relay/commit/5831c2f1f0f13eedc1cb60468c32fd32b2dc01d3)_
|
|
6
6
|
|
|
@@ -9,6 +9,7 @@ The time has finally come - RescriptRelay `1.0.0` is in beta! The one, big major
|
|
|
9
9
|
## Upgrade versions
|
|
10
10
|
|
|
11
11
|
- `react-relay` and `relay-runtime` to `13.2.0`
|
|
12
|
+
- `react` and `react-dom` to `18.0.0`
|
|
12
13
|
|
|
13
14
|
## Remove Packages
|
|
14
15
|
|
|
@@ -48,6 +49,18 @@ You can go ahead and remove these packages, that are no longer needed, as the co
|
|
|
48
49
|
|
|
49
50
|
### unreleased
|
|
50
51
|
|
|
52
|
+
### beta.19
|
|
53
|
+
|
|
54
|
+
- Fix top level node interface issue.
|
|
55
|
+
|
|
56
|
+
### beta.18
|
|
57
|
+
|
|
58
|
+
- Fix `useTransition` bindings, where `startTransition` broke after going to React 18. Kudos to [Emilios1995](https://github.com/Emilios1995) for researching and finding the issue!
|
|
59
|
+
|
|
60
|
+
### beta.17
|
|
61
|
+
|
|
62
|
+
- Upgrade to stable React 18
|
|
63
|
+
|
|
51
64
|
### beta.16
|
|
52
65
|
|
|
53
66
|
- Fix bug that caused issues when using unions in optimistic responses and `commitLocalPayload`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rescript-relay",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.19",
|
|
4
4
|
"main": "src/RescriptRelay.res",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gabriel Nordeborn",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@rescript/react": "0.10.3",
|
|
43
|
-
"@testing-library/jest-dom": "^5.16.
|
|
44
|
-
"@testing-library/react": "^13.0.0-alpha.
|
|
43
|
+
"@testing-library/jest-dom": "^5.16.3",
|
|
44
|
+
"@testing-library/react": "^13.0.0-alpha.6",
|
|
45
45
|
"bs-fetch": "^0.5.0",
|
|
46
46
|
"graphql-query-test-mock": "^0.12.1",
|
|
47
47
|
"jest": "^27.2.4",
|
|
48
48
|
"nock": "^11.7.0",
|
|
49
49
|
"node-fetch": "^2.6.0",
|
|
50
|
-
"react": "
|
|
51
|
-
"react-dom": "
|
|
50
|
+
"react": "18.0.0",
|
|
51
|
+
"react-dom": "18.0.0",
|
|
52
52
|
"react-relay": "13.2.0",
|
|
53
53
|
"relay-runtime": "13.2.0"
|
|
54
54
|
},
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"rescript": "^9.1.2"
|
|
64
64
|
},
|
|
65
65
|
"resolutions": {
|
|
66
|
-
"react": "18.0.0
|
|
67
|
-
"react-dom": "18.0.0
|
|
66
|
+
"react": "18.0.0",
|
|
67
|
+
"react-dom": "18.0.0"
|
|
68
68
|
}
|
|
69
69
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var Client = require("react-dom/client");
|
|
5
5
|
|
|
6
6
|
function renderConcurrentRootAtElementWithId(content, id) {
|
|
7
7
|
var element = document.getElementById(id);
|
|
@@ -12,9 +12,9 @@ function renderConcurrentRootAtElementWithId(content, id) {
|
|
|
12
12
|
Error: new Error()
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
Client.createRoot(element).render(content);
|
|
16
16
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
exports.renderConcurrentRootAtElementWithId = renderConcurrentRootAtElementWithId;
|
|
20
|
-
/* react-dom Not a pure module */
|
|
20
|
+
/* react-dom/client Not a pure module */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
include ReactDOM.Experimental
|
|
2
2
|
|
|
3
|
-
@module("react-dom")
|
|
3
|
+
@module("react-dom/client")
|
|
4
4
|
external createRoot: Dom.element => root = "createRoot"
|
|
5
5
|
|
|
6
6
|
@val @return(nullable)
|
|
@@ -15,6 +15,5 @@ let renderConcurrentRootAtElementWithId: (React.element, string) => unit = (cont
|
|
|
15
15
|
id ++ " found in the HTML.",
|
|
16
16
|
),
|
|
17
17
|
)
|
|
18
|
-
| Some(element) =>
|
|
19
|
-
createRoot(element)->render(content)
|
|
18
|
+
| Some(element) => createRoot(element)->render(content)
|
|
20
19
|
}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var React = require("react");
|
|
5
|
+
|
|
6
|
+
function useTransition(param) {
|
|
7
|
+
var match = React.useTransition();
|
|
8
|
+
var startTransition = match[1];
|
|
9
|
+
return [
|
|
10
|
+
match[0],
|
|
11
|
+
React.useCallback((function (cb) {
|
|
12
|
+
return startTransition(cb, undefined);
|
|
13
|
+
}), [startTransition])
|
|
14
|
+
];
|
|
15
|
+
}
|
|
4
16
|
|
|
5
17
|
var SuspenseList = {};
|
|
6
18
|
|
|
19
|
+
exports.useTransition = useTransition;
|
|
7
20
|
exports.SuspenseList = SuspenseList;
|
|
8
|
-
/*
|
|
21
|
+
/* react Not a pure module */
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
type callback<'input, 'output> = 'input => 'output
|
|
2
|
-
|
|
3
1
|
@module("react")
|
|
4
2
|
external useDeferredValue: 'value => 'value = "useDeferredValue"
|
|
5
3
|
|
|
6
4
|
@module("react")
|
|
7
|
-
external
|
|
8
|
-
|
|
5
|
+
external useTransitionWithOptions: unit => (
|
|
6
|
+
bool,
|
|
7
|
+
(. unit => unit, option<{"name": option<string>}>) => unit,
|
|
8
|
+
) = "useTransition"
|
|
9
|
+
|
|
10
|
+
let useTransition = () => {
|
|
11
|
+
let (isPending, startTransition) = useTransitionWithOptions()
|
|
12
|
+
(isPending, React.useCallback1(cb => startTransition(. cb, None), [startTransition]))
|
|
13
|
+
}
|
|
9
14
|
|
|
10
15
|
module SuspenseList = {
|
|
11
16
|
@module("react") @react.component
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@module("react")
|
|
2
|
+
external useDeferredValue: 'value => 'value = "useDeferredValue"
|
|
3
|
+
|
|
4
|
+
@module("react")
|
|
5
|
+
external useTransitionWithOptions: unit => (
|
|
6
|
+
bool,
|
|
7
|
+
(. unit => unit, option<{"name": option<string>}>) => unit,
|
|
8
|
+
) = "useTransition"
|
|
9
|
+
|
|
10
|
+
let useTransition: unit => (bool, React.callback<unit => unit, unit>)
|
|
11
|
+
|
|
12
|
+
module SuspenseList: {
|
|
13
|
+
@module("react") @react.component
|
|
14
|
+
external make: (
|
|
15
|
+
~children: React.element,
|
|
16
|
+
~revealOrder: [#forwards | #backwards | #together]=?,
|
|
17
|
+
) => React.element = "SuspenseList"
|
|
18
|
+
}
|
|
@@ -9,6 +9,7 @@ var Belt_Array = require("rescript/lib/js/belt_Array.js");
|
|
|
9
9
|
var Belt_Option = require("rescript/lib/js/belt_Option.js");
|
|
10
10
|
var Caml_option = require("rescript/lib/js/caml_option.js");
|
|
11
11
|
var Caml_exceptions = require("rescript/lib/js/caml_exceptions.js");
|
|
12
|
+
var ReactExperimental = require("../ReactExperimental.bs.js");
|
|
12
13
|
var RescriptReactRouter = require("@rescript/react/src/RescriptReactRouter.bs.js");
|
|
13
14
|
|
|
14
15
|
function matchesUrl(t, url) {
|
|
@@ -242,7 +243,7 @@ function RescriptRelayRouter$RouteRenderer(Props) {
|
|
|
242
243
|
});
|
|
243
244
|
var initialized = match[0];
|
|
244
245
|
var router = React.useContext(context);
|
|
245
|
-
var match$1 =
|
|
246
|
+
var match$1 = ReactExperimental.useTransition(undefined);
|
|
246
247
|
var startTransition = match$1[1];
|
|
247
248
|
var match$2 = React.useState(function () {
|
|
248
249
|
return Curry._1(router.get, undefined);
|
package/src/utils.js
CHANGED
|
@@ -174,6 +174,9 @@ function traverse(
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
if (isTopLevelNodeField) {
|
|
177
|
+
// If this is a top level node field we should try and convert, ensure
|
|
178
|
+
// it conforms to the desired shape (has the correct typename). If not,
|
|
179
|
+
// null it and return right away.
|
|
177
180
|
if (
|
|
178
181
|
v == null ||
|
|
179
182
|
!v.hasOwnProperty("__typename") ||
|
|
@@ -181,6 +184,7 @@ function traverse(
|
|
|
181
184
|
) {
|
|
182
185
|
newObj = getNewObj(newObj, currentObj);
|
|
183
186
|
newObj[key] = nullableValue;
|
|
187
|
+
return newObj;
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
190
|
|
package/src/utils.mjs
CHANGED
|
@@ -174,6 +174,9 @@ function traverse(
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
if (isTopLevelNodeField) {
|
|
177
|
+
// If this is a top level node field we should try and convert, ensure
|
|
178
|
+
// it conforms to the desired shape (has the correct typename). If not,
|
|
179
|
+
// null it and return right away.
|
|
177
180
|
if (
|
|
178
181
|
v == null ||
|
|
179
182
|
!v.hasOwnProperty("__typename") ||
|
|
@@ -181,6 +184,7 @@ function traverse(
|
|
|
181
184
|
) {
|
|
182
185
|
newObj = getNewObj(newObj, currentObj);
|
|
183
186
|
newObj[key] = nullableValue;
|
|
187
|
+
return newObj;
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
190
|
|