From fc0d94975b79cc5b94a3792809be970f55e9039d Mon Sep 17 00:00:00 2001 From: Simon Hanna Date: Fri, 23 Sep 2022 14:08:35 +0200 Subject: [PATCH] Do not clear isFetching state for subscriptions until they complete Fixes: #2774 --- packages/graphiql-react/src/execution.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/graphiql-react/src/execution.tsx b/packages/graphiql-react/src/execution.tsx index 3a466a54164..4fec738f1c7 100644 --- a/packages/graphiql-react/src/execution.tsx +++ b/packages/graphiql-react/src/execution.tsx @@ -232,11 +232,9 @@ export function ExecutionContextProvider(props: ExecutionContextProviderProps) { }; } - setIsFetching(false); setResponse(formatResult(fullResponse)); } else { const response = formatResult(result); - setIsFetching(false); setResponse(response); } }; @@ -294,6 +292,9 @@ export function ExecutionContextProvider(props: ExecutionContextProviderProps) { } } else { handleResponse(value); + if (queryId === queryIdRef.current) { + setIsFetching(false); + } } } catch (error) { setIsFetching(false);