Nik/include space ids - #571
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for including space IDs in entity query results, allowing applications to determine which public spaces an entity belongs to. This addresses issue #567 by introducing an optional includeSpaceIds parameter that, when set to true, enriches entities with a normalized spaceIds: string[] array.
Key changes:
- Added
includeSpaceIdsparameter tofindOnePublic,findManyPublic, andsearchManyPublicfunctions - Implemented space ID normalization that filters out null entries
- Extended React hooks (
useEntity,useEntities) to support the new parameter with proper type inference
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/hypergraph/src/entity/internal/normalize-space-ids.ts |
New utility function to filter null values from space ID arrays |
packages/hypergraph/src/entity/types.ts |
Added WithSpaceIds conditional type for type-safe space ID inclusion |
packages/hypergraph/src/entity/find-one-public.ts |
Added includeSpaceIds parameter support with GraphQL query modification and result parsing |
packages/hypergraph/src/entity/find-many-public.ts |
Extended to support includeSpaceIds with proper type inference for batch queries |
packages/hypergraph/src/entity/search-many-public.ts |
Added space IDs support to search functionality |
packages/hypergraph-react/src/internal/use-entity-public.tsx |
Updated React hook to accept and propagate includeSpaceIds parameter |
packages/hypergraph-react/src/internal/use-entities-public.tsx |
Extended batch entity hook with space IDs support |
packages/hypergraph-react/src/internal/types.ts |
Updated type definitions to include IncludeSpaceIds generic parameter |
packages/hypergraph-react/src/hooks/use-entity.tsx |
Added type-safe includeSpaceIds parameter to public API |
packages/hypergraph-react/src/hooks/use-entities.tsx |
Extended public hook with space IDs support and proper type inference |
packages/hypergraph/test/entity/space-ids-types.test.ts |
New type inference tests verifying correct behavior with and without includeSpaceIds |
packages/hypergraph/test/entity/find-many-public.test.ts |
Updated existing tests to include spaceIds field and added normalization test |
packages/hypergraph-react/test/space-ids-types.test.ts |
Type tests for React hooks ensuring proper space IDs type inference |
docs/docs/query-public-data.md |
Documentation explaining how to use includeSpaceIds with code examples |
apps/events/src/routes/podcasts.lazy.tsx |
Example usage demonstrating the new feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #567