Skip to content

Commit

Permalink
adapt to aliased fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
zth committed Jul 12, 2024
1 parent 09ee6f6 commit f0712fa
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 59 deletions.
8 changes: 2 additions & 6 deletions packages/rescript-relay/__tests__/Test_aliasedFragments.res
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ module Test = {
@react.component
let make = () => {
let query = Query.use(~variables={skipThing: false})
let firstNameData = FragmentFirstName.use(
query.loggedInUser.testAliasedFragments_userFirstName.fragmentRefs,
)
let lastNameData = FragmentLastName.useOpt(
query.loggedInUser.testAliasedFragments_userLastName->Belt.Option.map(f => f.fragmentRefs),
)
let firstNameData = FragmentFirstName.use(query.loggedInUser.testAliasedFragments_userFirstName)
let lastNameData = FragmentLastName.useOpt(query.loggedInUser.testAliasedFragments_userLastName)

<div>
{React.string(
Expand Down
14 changes: 6 additions & 8 deletions packages/rescript-relay/__tests__/Test_codesplit.res
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,16 @@ module Test = {
<div>
{switch member {
| {hasNameComponent_hasName: Some(hasNameComponent_hasName)} =>
<HasNameComponent hasName=hasNameComponent_hasName.fragmentRefs />
<HasNameComponent hasName=hasNameComponent_hasName />
| _ => React.null
}}
{switch member {
| {groupAvatar_group: Some(groupAvatar_group)} =>
<GroupAvatar group=groupAvatar_group.fragmentRefs />
| {groupAvatar_group: Some(groupAvatar_group)} => <GroupAvatar group=groupAvatar_group />
| {userAvatar_user: Some(userAvatar_user), description, bestFriend} =>
<>
<UserAvatar user=userAvatar_user.fragmentRefs />
<UserAvatar user=userAvatar_user />
{switch description {
| Some({richContent_content}) =>
<RichContent content=richContent_content.fragmentRefs />
| Some({richContent_content}) => <RichContent content=richContent_content />
| None => React.null
}}
{switch bestFriend {
Expand All @@ -63,10 +61,10 @@ module Test = {
}) =>
<>
{switch userAvatar_user {
| Some(userAvatar_user) => <UserAvatar user=userAvatar_user.fragmentRefs />
| Some(userAvatar_user) => <UserAvatar user=userAvatar_user />
| None => React.null
}}
<RichContent content=richContent_content.fragmentRefs />
<RichContent content=richContent_content />
</>
| _ => React.null
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/rescript-relay/__tests__/UserAvatar.res
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ let make = (~user: RescriptRelay.fragmentRefs<[#UserAvatar_user]>) => {
<div>
{React.string("User avatarUrl: " ++ user.avatarUrl->Belt.Option.getWithDefault("-"))}
</div>
<UserName user=user.userName_user.fragmentRefs />
<UserName user=user.userName_user />
</>
}

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.

0 comments on commit f0712fa

Please sign in to comment.