diff --git a/src/react/hooks/useQuery.ts b/src/react/hooks/useQuery.ts index 363ca3ba3a3..73dbcc44e70 100644 --- a/src/react/hooks/useQuery.ts +++ b/src/react/hooks/useQuery.ts @@ -53,6 +53,7 @@ export function useQuery< if ( context.renderPromises && + options?.fetchPolicy !== "standby" && options?.ssr !== false && !options?.skip && obsQuery.getCurrentResult().loading diff --git a/src/react/ssr/RenderPromises.ts b/src/react/ssr/RenderPromises.ts index fb74c87c304..556a9b9a4c4 100644 --- a/src/react/ssr/RenderPromises.ts +++ b/src/react/ssr/RenderPromises.ts @@ -95,7 +95,14 @@ export class RenderPromises { // as getting stuck in an infinite rendering loop because we kept calling // queryInstance.fetchData for the same Query component indefinitely. this.lookupQueryInfo(queryInstance).seen = true; - promises.push(promise); + // neglect all queries that are not ready in SSR to prevent waiting forever + if ( + queryInstance?.fetchPolicy !== "standby" || + queryInstance?.ssr !== false || + !queryInstance?.skip + ) { + promises.push(promise); + } }); this.queryPromises.clear(); return Promise.all(promises);