Skip to content

add param offset for Entity.findManyPublic, Entity.searchManyPublic, useEntities - #551

Merged
nikgraf merged 1 commit into
mainfrom
ng/add-support-for-offset
Nov 14, 2025
Merged

add param offset for Entity.findManyPublic, Entity.searchManyPublic, useEntities#551
nikgraf merged 1 commit into
mainfrom
ng/add-support-for-offset

Conversation

@nikgraf

@nikgraf nikgraf commented Nov 14, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds pagination support by introducing an offset parameter to entity query functions (Entity.findManyPublic, Entity.searchManyPublic, and useEntities). The implementation enables more granular control over data fetching for improved pagination capabilities.

  • Added offset parameter with default value of 0 to core query functions
  • Updated GraphQL queries across all nesting levels (0, 1, 2) to accept and use the offset parameter
  • Integrated offset parameter throughout the React hooks layer, including query cache keys

Reviewed Changes

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

Show a summary per file
File Description
packages/hypergraph/src/entity/search-many-public.ts Added offset parameter to type definition, GraphQL queries (all levels), and function implementation
packages/hypergraph/src/entity/find-many-public.ts Added offset parameter to type definition, GraphQL queries (all levels), and function implementation
packages/hypergraph-react/src/internal/use-entities-public.tsx Added offset to query parameters and query key for cache invalidation
packages/hypergraph-react/src/internal/types.ts Added offset parameter to QueryPublicParams type
packages/hypergraph-react/src/hooks/use-entities.tsx Added offset parameter to UseEntitiesParams and passed through to useEntitiesPublic
apps/events/src/routes/podcasts.lazy.tsx Example usage of new offset parameter with updated space ID and first value
apps/events/src/schema.ts Updated Project and Podcast schema definitions (property and relation ID changes)
.changeset/witty-coats-march.md Changeset documenting the new offset parameter feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


export const useEntitiesPublic = <S extends Schema.Schema.AnyNoContext>(type: S, params?: QueryPublicParams<S>) => {
const { enabled = true, filter, include, space: spaceFromParams, first = 100 } = params ?? {};
const { enabled = true, filter, include, space: spaceFromParams, first = 100, offset } = params ?? {};

Copilot AI Nov 14, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The offset parameter should have a default value of 0 to be consistent with the implementation in findManyPublic and searchManyPublic functions. Without a default, if offset is undefined, it will be passed as undefined to Entity.findManyPublic, though the function itself has a default value that will handle it. For consistency and clarity, consider adding the default here:

const { enabled = true, filter, include, space: spaceFromParams, first = 100, offset = 0 } = params ?? {};
Suggested change
const { enabled = true, filter, include, space: spaceFromParams, first = 100, offset } = params ?? {};
const { enabled = true, filter, include, space: spaceFromParams, first = 100, offset = 0 } = params ?? {};

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +7
add param `offset` for Entity.findManyPublic, Entity.searchManyPublic, useEntities

No newline at end of file

Copilot AI Nov 14, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] This line contains trailing whitespace. Consider removing it to maintain code cleanliness.

Suggested change
add param `offset` for Entity.findManyPublic, Entity.searchManyPublic, useEntities
add param `offset` for Entity.findManyPublic, Entity.searchManyPublic, useEntities

Copilot uses AI. Check for mistakes.
@nikgraf
nikgraf merged commit f51992d into main Nov 14, 2025
12 checks passed
@nikgraf
nikgraf deleted the ng/add-support-for-offset branch November 14, 2025 14:35
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.

2 participants