Skip to content

Conversation

nikgraf
Copy link
Collaborator

@nikgraf nikgraf commented Jul 4, 2025

No description provided.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a first parameter to limit the number of results in public GraphQL queries.

  • Adds first to the QueryParams type and forwards it through useQuery and useQueryPublic.
  • Updates GraphQL query documents to accept a $first: Int argument and applies it in the request.
  • Sets a default first = 100 in useQueryPublic and demonstrates usage in the playground.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/hypergraph-react/src/use-query.tsx Added first to params destructuring and forwarding
packages/hypergraph-react/src/internal/use-query-public.tsx Extended queries with $first, default handling, and forwarding
packages/hypergraph-react/src/internal/types.ts Added optional first to QueryPublicParams
apps/events/src/components/playground.tsx Example usage of first parameter
Comments suppressed due to low confidence (2)

packages/hypergraph-react/src/use-query.tsx:13

  • New first behavior isn't covered by existing tests; consider adding unit or integration tests to verify pagination limits in both public and local queries.
  first?: number;

packages/hypergraph-react/src/use-query.tsx:150

  • useQueryLocal doesn't accept a first parameter, so local queries cannot be limited; either document this difference or add first support to local queries for consistency.
  const localResult = useQueryLocal(type, { enabled: mode === 'private', filter, include, space });

mappingEntry?.typeIds,
relationTypeIdsLevel1,
relationTypeIdsLevel2,
// TODO should `first` be in here?
Copy link

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first parameter should be included in the queryKey array to ensure cache entries vary by first value; add first after relationTypeIdsLevel2.

Suggested change
// TODO should `first` be in here?
first,

Copilot uses AI. Check for mistakes.

queryDocument = entitiesQueryDocumentLevel2;
}

console.log('first', first);
Copy link

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this debug console.log statement to avoid noisy logs in production.

Suggested change
console.log('first', first);

Copilot uses AI. Check for mistakes.

@nikgraf nikgraf merged commit 86d8628 into main Jul 4, 2025
6 checks passed
@nikgraf nikgraf deleted the ng/add-first-filter branch July 4, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant