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): Properly type-constrain ErrorTypedLink's forward response stream #616

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jimgerth
Copy link

In the ErrorTypedLink, the response stream recieved via the forward function is not type-constrained, thus cast it to be of the generic types TData and TVars.

This fixes an error that could sometimes occur, where the forward response stream was of a different type than TData and TVars, which mismatched with the StreamTransformer's inferred types, throwing an exception.

LinkException(type '_StreamHandlerTransformer<OperationResponse<dynamic, dynamic>, OperationResponse<dynamic, dynamic>>' is not a subtype of type 'StreamTransformer<OperationResponse<ConcreteTypeData, ConcreteTypeVars>, OperationResponse<dynamic, dynamic>>' of 'streamTransformer',
#0      Stream.transform (dart:async/stream.dart:1007:50)
#1      ErrorTypedLink.request (package:ferry/src/error_typed_link.dart:25:41)
#2      _TypedLinkChain.request.<anonymous closure>.<anonymous closure> (package:ferry_exec/src/typed_link.dart:131:46)
#3      _TypedLinkChain.request (package:ferry_exec/src/typed_link.dart:132:9)
#4      Client.request (package:ferry/ferry.dart:80:18)

In the ErrorTypedLink, the response stream recieved via the forward
function is not type-constrained, thus cast it to be of the generic
types TData and TVars.

Signed-off-by: Jim Gerth <jim.frederic.gerth@gmail.com>
Copy link

netlify bot commented Nov 18, 2024

Deploy Preview for ferry-gql canceled.

Name Link
🔨 Latest commit 7b72f20
🔍 Latest deploy log https://app.netlify.com/sites/ferry-gql/deploys/673b57298cf4f600089d5cf4

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.

1 participant