Skip to content

Commit

Permalink
Merge pull request #313 from apollographql/pr/fix-312
Browse files Browse the repository at this point in the history
more explicit `PreloadQuery` return type
  • Loading branch information
phryneas authored Jun 10, 2024
2 parents bef6f04 + 650f886 commit 3325025
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/client-react-streaming/src/PreloadQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function PreloadQuery<TData, TVariables extends OperationVariables>({
| ((
queryRef: TransportedQueryRef<NoInfer<TData>, NoInfer<TVariables>>
) => ReactNode);
}) {
}): React.ReactElement {
const preloadOptions = {
...options,
fetchPolicy: "cache-first" as const,
Expand Down
4 changes: 2 additions & 2 deletions packages/client-react-streaming/src/registerApolloClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ interface PreloadQueryProps<TData, TVariables>
interface PreloadQueryComponent {
<TData, TVariables extends OperationVariables>(
props: PreloadQueryProps<TData, TVariables>
): React.ReactNode;
): React.ReactElement;
}

function makePreloadQuery(
getClient: () => Promise<ApolloClient<any>> | ApolloClient<any>
) {
return function PreloadQuery<TData, TVariables extends OperationVariables>(
props: PreloadQueryProps<TData, TVariables>
): React.ReactNode {
): React.ReactElement {
// we directly execute the bound component instead of returning JSX to keep the tree a bit tidier
return UnboundPreloadQuery({ ...props, getClient });
};
Expand Down

0 comments on commit 3325025

Please sign in to comment.