Don't setTimeout in loadQuery in SSR
@@ -169,7 +169,7 @@ function loadQuery<TQuery: OperationType, TEnvironmentProviderOptions>(
({dispose: cancelOnLoadCallback} = PreloadableQueryRegistry.onLoad(
moduleId,
preloadedModule => {
- clearTimeout(loadQueryAstTimeoutId);
+ loadQueryAstTimeoutId != null && clearTimeout(loadQueryAstTimeoutId);
cancelOnLoadCallback();
const operation = createOperationDescriptor(
preloadedModule,
@@ -178,6 +178,7 @@ function loadQuery<TQuery: OperationType, TEnvironmentProviderOptions>(
executeWithSource(operation, source);
},
));
+ if (!environment.isServer()) {
loadQueryAstTimeoutId = setTimeout(() => {
cancelOnLoadCallback();
const onTimeout = options?.onQueryAstLoadTimeout;
@@ -189,6 +190,7 @@ function loadQuery<TQuery: OperationType, TEnvironmentProviderOptions>(
normalizationSubject.complete();
}, LOAD_QUERY_AST_MAX_TIMEOUT);
}
+ }
} else {
const graphQlTaggedNode: GraphQLTaggedNode = (preloadableRequest: $FlowFixMe);
const request = getRequest(graphQlTaggedNode);
