-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* up packages, and pull latest compiler * bind waitForFragmentData * 3.1.0 * add experimental non React mode to the PPX * fix inclusion * changelog * up docs
- Loading branch information
Showing
31 changed files
with
668 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule relay
updated
2882 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 24 additions & 14 deletions
38
packages/rescript-relay/__tests__/__generated__/TestAliasedFragmentsQuery_graphql.res
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
76 changes: 48 additions & 28 deletions
76
packages/rescript-relay/__tests__/__generated__/TestCodesplitQuery_graphql.res
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 1 addition & 2 deletions
3
packages/rescript-relay/__tests__/__generated__/TestFragmentRequiredPlural_user_graphql.res
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 1 addition & 2 deletions
3
packages/rescript-relay/__tests__/__generated__/TestFragmentRequired_user_graphql.res
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.