graphql-flutter
graphql-flutter copied to clipboard
QueryWidget still makes query request when is not rendered anymore
Describe the issue
- QueryWidget still makes query request when is not rendered anymore
Widget build(BuildContext context) {
final loggedInUserId = context.watch<AuthBloc>().state.maybeWhen(
orElse: () => '',
authenticated: (user) => user.userId,
);
if (loggedInUserId.isEmpty) {
return const SliverToBoxAdapter(
child: SizedBox.shrink(),
);
}
return Query$GetUserDiscoverySwipes$Widget(
options: Options$Query$GetUserDiscoverySwipes(
variables: Variables$Query$GetUserDiscoverySwipes(
skip: 0,
limit: 100,
state: Enum$UserDiscoverySwipeState.pending,
),
),
As above, I only render QueryWidget when ever the user is logged in, but somehow when I logged out, the query request is still called, I tried to add breakpoint, the widget is not rendered, but the request is still proceed
Expected behavior The request should not be called when the widget is not rendered anymore
device / execution context
- iOS 17.0 Simulator
- graphql_flutter: ^5.1.2