Skip to content

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 <[email protected]>
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/677c0372356a4d00086e9db4

@knaeckeKami
Copy link
Collaborator

This fixes an error that could sometimes occur,

Can you show a repro, how this error could occur?

@julianscheel julianscheel force-pushed the fix/error-link-type-mismatch branch from 8337409 to 7b72f20 Compare January 6, 2025 16:23
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.

2 participants