Query a list of entities by their GUIDs.
You can fetch a maximum of 25 entities in one query.
Usage
import { EntitiesByGuidsQuery } from 'nr1'
Examples
Declarative Query
<EntitiesByGuidsQuery entityGuids={[ 'MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzIx', 'MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzUz', ]}> {({ loading, error, data }) => { if (loading) { return <Spinner />; }
if (error) { return 'Error!'; }
return ( <List items={data.entities} rowHeight={20}> {({ item }) => <ListItem key={item.guid}>{item.name}</ListItem>} </List> ); }}</EntitiesByGuidsQuery>
Imperative query
EntitiesByGuidsQuery.query({ entityGuids: [ 'MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzIx', 'MTIzNDU2fEZPT3xCQVJ8OTg3NjU0MzUz', ],}).then(({ data }) => console.log(data));
Props
function | Render prop function as a child. function ( |
object | GraphQL fragment document parsed into an AST by
|
REQUIREDstring[] | GUID of the entities to query. |
enum | Allows you to specify how you want your query to interact with the cached data.
|
boolean | |
boolean | If |
number | Interval in milliseconds to poll for new data. Set to zero to avoid any kind of regular polling. |
boolean | When set to |
enum[] | Array of criteras used to sort the entity search results. <Array of |
Methods
EntitiesByGuidsQuery.query
function (props: Object Object containing the query options. Any EntitiesByGuidsQuery
prop is a valid option except children
and pollInterval
.
) => PromiseQueryResult
Type definitions
PromiseQueryResult
{error: ApolloClient.ApolloError, Runtime error with graphQLErrors
and networkError
properties.
data: Object, Object containing the result of your query.
fetchMore: function|null, If not null
, fetchMore
allows you to load more results for your query. New data is merged with previous data.
refetch: function, Refetch the query.
}
QueryResult
{loading: boolean, Indicates that the request is in flight.
error: ApolloClient.ApolloError, Runtime error with graphQLErrors
and networkError
properties.
data: Object, Object containing the result of your query.
fetchMore: function|null, If not null
, fetchMore
allows you to load more results for your query. New data is merged with previous data.
refetch: function, Refetch the query.
}