Skip to content

Commit 80111e2

Browse files
committed
temp commit
1 parent 966d73d commit 80111e2

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/react/hooks/useQuery.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export function useQuery<
8383
sub.unsubscribe();
8484
},
8585
complete() {
86+
// TODO: Does this branch ever get called before next() and error()?
8687
resolve();
8788
},
8889
});
@@ -246,12 +247,9 @@ export function useQuery<
246247

247248
// TODO: This is a hack to make sure useLazyQuery executions update the
248249
// obsevable query options for ssr.
249-
if (
250-
context.renderPromises &&
251-
options?.ssr !== false &&
252-
result.loading
253-
) {
254-
obsQuery.setOptions(createWatchQueryOptions(query, options)).catch(() => {});
250+
if (context.renderPromises && options?.ssr !== false && result.loading) {
251+
obsQuery.setOptions(createWatchQueryOptions(query, options))
252+
.catch(() => {});
255253
}
256254
}
257255

src/react/ssr/RenderPromises.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,37 +44,37 @@ export class RenderPromises {
4444
// Registers the server side rendered observable.
4545
public registerSSRObservable<TData, TVariables>(
4646
observable: ObservableQuery<any, TVariables>,
47-
props: QueryDataOptions<TData, TVariables>
47+
options: QueryDataOptions<TData, TVariables>
4848
) {
4949
if (this.stopped) return;
50-
this.lookupQueryInfo(props).observable = observable;
50+
this.lookupQueryInfo(options).observable = observable;
5151
}
5252

5353
// Get's the cached observable that matches the SSR Query instances query and variables.
5454
public getSSRObservable<TData, TVariables>(
55-
props: QueryDataOptions<TData, TVariables>
55+
options: QueryDataOptions<TData, TVariables>
5656
): ObservableQuery<any, TVariables> | null {
57-
return this.lookupQueryInfo(props).observable;
57+
return this.lookupQueryInfo(options).observable;
5858
}
5959

6060
public addQueryPromise(
6161
queryInstance: QueryData,
62+
// TODO: This callback is a noop on the useQuery side.
6263
finish: () => React.ReactNode
6364
): React.ReactNode {
6465
if (!this.stopped) {
6566
const info = this.lookupQueryInfo(queryInstance.getOptions());
6667
if (!info.seen) {
6768
this.queryPromises.set(
6869
queryInstance.getOptions(),
69-
new Promise(resolve => {
70-
resolve(queryInstance.fetchData());
71-
})
70+
new Promise(resolve => resolve(queryInstance.fetchData()))
7271
);
7372
// Render null to abandon this subtree for this rendering, so that we
7473
// can wait for the data to arrive.
7574
return null;
7675
}
7776
}
77+
7878
return finish();
7979
}
8080

0 commit comments

Comments
 (0)