@@ -10,10 +10,11 @@ import { GEO_API_TESTNET_ENDPOINT } from './constants.js';
1010import type { QueryPublicParams } from './types.js' ;
1111
1212const entitiesQueryDocumentLevel0 = gql `
13- query entities($spaceId: UUID!, $typeIds: [UUID!]!) {
13+ query entities($spaceId: UUID!, $typeIds: [UUID!]!, $first: Int ) {
1414 entities(
1515 filter: {
1616 relations: {some: {typeId: {is: "8f151ba4-de20-4e3c-9cb4-99ddf96f48f1"}, toEntityId: {in: $typeIds}}}, spaceIds: {in: [$spaceId]}},
17+ first: $first
1718 ) {
1819 id
1920 name
@@ -26,8 +27,10 @@ query entities($spaceId: UUID!, $typeIds: [UUID!]!) {
2627` ;
2728
2829const entitiesQueryDocumentLevel1 = gql `
29- query entities($spaceId: UUID!, $typeIds: [UUID!]!, $relationTypeIdsLevel1: [UUID!]!) {
30- entities(filter: {
30+ query entities($spaceId: UUID!, $typeIds: [UUID!]!, $relationTypeIdsLevel1: [UUID!]!, $first: Int) {
31+ entities(
32+ first: $first
33+ filter: {
3134 relations: {some: {typeId: {is: "8f151ba4-de20-4e3c-9cb4-99ddf96f48f1"}, toEntityId: {in: $typeIds}}}, spaceIds: {in: [$spaceId]}}) {
3235 id
3336 name
@@ -53,8 +56,10 @@ query entities($spaceId: UUID!, $typeIds: [UUID!]!, $relationTypeIdsLevel1: [UUI
5356` ;
5457
5558const entitiesQueryDocumentLevel2 = gql `
56- query entities($spaceId: UUID!, $typeIds: [UUID!]!, $relationTypeIdsLevel1: [UUID!]!, $relationTypeIdsLevel2: [UUID!]!) {
57- entities(filter: {
59+ query entities($spaceId: UUID!, $typeIds: [UUID!]!, $relationTypeIdsLevel1: [UUID!]!, $relationTypeIdsLevel2: [UUID!]!, $first: Int) {
60+ entities(
61+ first: $first
62+ filter: {
5863 relations: {some: {typeId: {is: "8f151ba4-de20-4e3c-9cb4-99ddf96f48f1"}, toEntityId: {in: $typeIds}}}, spaceIds: {in: [$spaceId]}}) {
5964 id
6065 name
@@ -290,7 +295,7 @@ export const parseResult = <S extends Entity.AnyNoContext>(
290295} ;
291296
292297export const useQueryPublic = < S extends Entity . AnyNoContext > ( type : S , params ?: QueryPublicParams < S > ) => {
293- const { enabled = true , include } = params ?? { } ;
298+ const { enabled = true , include, first = 100 } = params ?? { } ;
294299 const { space } = useHypergraphSpaceInternal ( ) ;
295300 const mapping = useSelector ( store , ( state ) => state . context . mapping ) ;
296301
@@ -327,6 +332,7 @@ export const useQueryPublic = <S extends Entity.AnyNoContext>(type: S, params?:
327332 mappingEntry ?. typeIds ,
328333 relationTypeIdsLevel1 ,
329334 relationTypeIdsLevel2 ,
335+ // TODO should `first` be in here?
330336 ] ,
331337 queryFn : async ( ) => {
332338 let queryDocument = entitiesQueryDocumentLevel0 ;
@@ -342,6 +348,7 @@ export const useQueryPublic = <S extends Entity.AnyNoContext>(type: S, params?:
342348 typeIds : mappingEntry ?. typeIds || [ ] ,
343349 relationTypeIdsLevel1,
344350 relationTypeIdsLevel2,
351+ first,
345352 } ) ;
346353 return result ;
347354 } ,
0 commit comments