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

fix(ferry): Fix problem with operationRequest generated on initial request being included in response each time. #545

Merged
merged 2 commits into from
Nov 11, 2023

Conversation

YusukeMoriJapan
Copy link
Contributor

@YusukeMoriJapan YusukeMoriJapan commented Nov 1, 2023

This pull request fix #546 issue.

@YusukeMoriJapan YusukeMoriJapan marked this pull request as draft November 1, 2023 06:45
@YusukeMoriJapan YusukeMoriJapan marked this pull request as ready for review November 1, 2023 08:01
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this pull request, I changed my test code because the Request type generated at the time of the request and the Requst type in the response were different.

The following is a log of the failure.
There seems to be a difference in the contents of the DocumentNode.
It can be confirmed from the log that the DocumentNode included in the Response contains a typename.

failure test result

dart:async _CustomZone.runUnary
Expected: should do the following in order:
• emit an event that <Instance of ‘OperationResponse<GHumanWithArgsData, GHumanWithArgsVars>’> with data: _$GHumanWithArgsData:<GHumanWithArgsData {
G__typename=Query,
human=GHumanWithArgsData_human {
G__typename=Human,
id=1,
name=Luke,
friendsConnection=GHumanWithArgsData_human_friendsConnection {
G__typename=FriendsConnection,
},
},
}> and linkException: null and errors: null and source: DataSource:<DataSource.Link> and request: _$GHumanWithArgsReq:<GHumanWithArgsReq {
vars=GHumanWithArgsVars {
id=1,
},
operation=Operation(document: DocumentNode(“query HumanWithArgs($id: ID!, $friendsAfter: ID) {\n human(id: $id) {\n id\n name\n height\n friendsConnection(first: 10, after: $friendsAfter) {\n friends {\n id\n name\n }\n }\n }\n}“), operationName: HumanWithArgs),
executeOnListen=true,
}>
• emit an event that <Instance of ‘OperationResponse<GHumanWithArgsData?, GHumanWithArgsVars>’> with data: null and linkException: null and errors: null and source: DataSource:<DataSource.Cache> and request: _$GHumanWithArgsReq:<GHumanWithArgsReq {
vars=GHumanWithArgsVars {
id=1,
},
operation=Operation(document: DocumentNode(“query HumanWithArgs($id: ID!, $friendsAfter: ID) {\n human(id: $id) {\n id\n name\n height\n friendsConnection(first: 10, after: $friendsAfter) {\n friends {\n id\n name\n }\n }\n }\n}“), operationName: HumanWithArgs),
executeOnListen=true,
}>
• be done
Actual: <Instance of ‘_BoundSinkStream<dynamic, OperationResponse<GHumanWithArgsData, GHumanWithArgsVars>>’>
Which: emitted • Instance of ‘OperationResponse<GHumanWithArgsData, GHumanWithArgsVars>’
which didn’t emit an event that <Instance of ‘OperationResponse<GHumanWithArgsData, GHumanWithArgsVars>’> with data: _$GHumanWithArgsData:<GHumanWithArgsData {
G__typename=Query,
human=GHumanWithArgsData_human {
G__typename=Human,
id=1,
name=Luke,
friendsConnection=GHumanWithArgsData_human_friendsConnection {
G__typename=FriendsConnection,
},
},
}> and linkException: null and errors: null and source: DataSource:<DataSource.Link> and request: _$GHumanWithArgsReq:<GHumanWithArgsReq {
vars=GHumanWithArgsVars {
id=1,
},
operation=Operation(document: DocumentNode(“query HumanWithArgs($id: ID!, $friendsAfter: ID) {\n human(id: $id) {\n id\n name\n height\n friendsConnection(first: 10, after: $friendsAfter) {\n friends {\n id\n name\n }\n }\n }\n}“), operationName: HumanWithArgs),
executeOnListen=true,
}>
because it emitted an event that has request with value _$GHumanWithArgsReq:<GHumanWithArgsReq {
vars=GHumanWithArgsVars {
id=1,
},
operation=Operation(document: DocumentNode(“query HumanWithArgs($id: ID!, $friendsAfter: ID) {\n __typename\n human(id: $id) {\n __typename\n id\n name\n height\n friendsConnection(first: 10, after: $friendsAfter) {\n __typename\n friends {\n __typename\n id\n name\n }\n }\n }\n}“), operationName: HumanWithArgs),
executeOnListen=true,
}>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, some explanations were missing.

The DocumentNode in the Response contains __typename, but the DocumentNode in the Request does not seem to contain __typename.

@knaeckeKami knaeckeKami merged commit 701cd33 into gql-dart:master Nov 11, 2023
4 checks passed
@knaeckeKami
Copy link
Collaborator

thanks for your contribution! i will add this as breaking change, as some users might rely on identity-equals between to sent and received request.

@YusukeMoriJapan
Copy link
Contributor Author

@knaeckeKami
Thank you for merging. I'm using ferry in my Flutter project, and it's really helpful.
I look forward to further advancements in ferry. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

operationRequest generated on initial request being included in response each time, when using IsolateClient
2 participants