Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relay 18.2 #542

Merged
merged 7 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# master

# 3.1.0

This brings the Relay version to `18.2.0`.

If you have enabled the feature flags in `relay.config.js` for aliased fragments or Relay resolvers you'll need to remove them from the config file as they are now on by default, and not removing them will cause the compiler to fail with a non super helpful error message.

- **Upgrade versions**: `react-relay` and `relay-runtime` to `18.2.0`.
- Add support for `Fragment.waitForFragmentData`, a new API in Relay 18.2 that lets you wait for fragment data outside of React.
- Experimental: Add a "non React" mode to the PPX, which makes sure only APIs that don't rely on React directly are exposed. This is intended to be a way to simplify using RescriptRelay without React. Activate by passing `-non-react` to the PPX, like `"ppx-flags": [["rescript-relay/ppx", "-non-react"]]`.

# 3.0.1

- Add `Environment.findAllConnectionIds` for finding all IDs of all connection instances for a specific connection, regardless of what configs that connection has been fetched (and cached) with.
Expand Down
2 changes: 1 addition & 1 deletion packages/relay
Submodule relay updated 2882 files
25 changes: 25 additions & 0 deletions packages/rescript-relay/__tests__/Test_nonReact-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require("@testing-library/jest-dom/extend-expect");
const queryMock = require("./queryMock");

const { test_nonReact } = require("./Test_nonReact.bs");

describe("Fragment", () => {
test("waitForFragmentData works", async () => {
queryMock.mockQuery({
name: "TestNonReactQuery",
data: {
loggedInUser: {
id: "user-1",
firstName: "First",
onlineStatus: "Online",
},
},
});

const res = await test_nonReact();
expect(res.waitForFragmentData).toEqual({
firstName: "First",
onlineStatus: "Online",
});
});
});
35 changes: 35 additions & 0 deletions packages/rescript-relay/__tests__/Test_nonReact.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module Query = %relay(`
query TestNonReactQuery {
loggedInUser {
firstName
...TestNonReact_user
}
}
`)

module Fragment = %relay(`
fragment TestNonReact_user on User {
firstName
onlineStatus
}
`)

@live
let test_nonReact = async () => {
let network = RescriptRelay.Network.makePromiseBased(~fetchFunction=RelayEnv.fetchQuery)

let environment = RescriptRelay.Environment.make(
~network,
~store=RescriptRelay.Store.make(~source=RescriptRelay.RecordSource.make()),
)

let query = await Query.fetchPromised(~environment, ~variables=())
let fragmentData = await Fragment.waitForFragmentData(
~environment,
query.loggedInUser.fragmentRefs,
)

{
"waitForFragmentData": fragmentData,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Logger = {

let getLoggedArg = () => loggedArg.contents

let expectedArg: RescriptRelay.RelayFieldLogger.arg = MissingFieldLog({
let expectedArg: RescriptRelay.RelayFieldLogger.arg = MissingRequiredFieldLog({
owner: "TestRequiredFieldLoggerQuery",
fieldPath: "loggedInUser.firstName",
})
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading