Skip to content

Commit 8337409

Browse files
committed
Optionally disable RequestControllerTypedLink
The RequestControllerTypedLink has the downside of absorbing 'COMPLETE' events. Especially for subscriptions these can be of interest for the client to trigger an action, like recreating the subscription. Allow to disable the RequestControllerTypedLink completely for this purpose. Signed-off-by: Julian Scheel <julian@jusst.de>
1 parent 7b72f20 commit 8337409

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/ferry/lib/ferry.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Client extends TypedLinkWithCacheAndRequestController {
2626
final Map<String, Function> updateCacheHandlers;
2727
final Map<OperationType, FetchPolicy> defaultFetchPolicies;
2828
final bool addTypename;
29+
final bool refetchPaginationSupport;
2930

3031
@override
3132
late Cache cache;
@@ -45,13 +46,15 @@ class Client extends TypedLinkWithCacheAndRequestController {
4546
this.updateCacheHandlers = const {},
4647
this.defaultFetchPolicies = const {},
4748
this.addTypename = true,
49+
this.refetchPaginationSupport = true,
4850
}) {
4951
this.cache = cache ??= _defaultCache = Cache();
5052
this.requestController = requestController ??=
5153
_defaultRequestController = StreamController.broadcast();
5254
_typedLink = TypedLink.from([
5355
ErrorTypedLink(),
54-
RequestControllerTypedLink(this.requestController),
56+
if (refetchPaginationSupport)
57+
RequestControllerTypedLink(this.requestController),
5558
if (addTypename) AddTypenameTypedLink(),
5659
if (updateCacheHandlers.isNotEmpty)
5760
UpdateCacheTypedLink(

0 commit comments

Comments
 (0)