Skip to content

Commit

Permalink
usePrelaodedQuery should also take a renderPolicy like useLazyLoadQuery
Browse files Browse the repository at this point in the history
Reviewed By: alunyov

Differential Revision: D18716512

fbshipit-source-id: 555ff04692897334751649a10fea1dddce89cddf
  • Loading branch information
Juan Tejada authored and facebook-github-bot committed Nov 27, 2019
1 parent 4b5ce66 commit fc1b88b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/relay-experimental/usePreloadedQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ const {
} = require('relay-runtime');

import type {PreloadedQuery} from './EntryPointTypes.flow';
import type {RenderPolicy} from './QueryResource';
import type {GraphQLTaggedNode, OperationType} from 'relay-runtime';

function usePreloadedQuery<TQuery: OperationType>(
gqlQuery: GraphQLTaggedNode,
preloadedQuery: PreloadedQuery<TQuery>,
options?: {|
UNSTABLE_renderPolicy?: RenderPolicy,
|},
): $ElementType<TQuery, 'response'> {
// We need to use this hook in order to be able to track if
// loadQuery was called during render
Expand Down Expand Up @@ -57,6 +61,7 @@ function usePreloadedQuery<TQuery: OperationType>(
}),
fetchPolicy,
query: operation,
renderPolicy: options?.UNSTABLE_renderPolicy,
});
return data;
}
Expand Down

0 comments on commit fc1b88b

Please sign in to comment.