Skip to content

add multi spaces filter - #562

Merged
nikgraf merged 1 commit into
mainfrom
nik/multi-spaces-filter
Dec 3, 2025
Merged

add multi spaces filter#562
nikgraf merged 1 commit into
mainfrom
nik/multi-spaces-filter

Conversation

@nikgraf

@nikgraf nikgraf commented Dec 3, 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 support for querying public entities across multiple spaces, introducing a flexible space selection API with three modes: single space, multiple spaces, and all spaces. The implementation includes comprehensive type safety through discriminated unions and updates the GraphQL query generation to handle each mode appropriately.

  • Introduces SpaceSelectionInput type with three mutually exclusive options: space (single), spaces (array), or spaces: 'all'
  • Updates GraphQL query builders to conditionally generate filters based on space selection mode
  • Exposes the new multi-space API through React hooks (useEntities, useEntitiesPublicInfinite)

Reviewed changes

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

Show a summary per file
File Description
packages/hypergraph/src/entity/types.ts Defines the SpaceSelectionInput discriminated union type
packages/hypergraph/src/entity/internal/space-selection.ts Implements space selection normalization and validation logic
packages/hypergraph/test/entity/space-selection.test.ts Adds comprehensive tests for space selection normalization
packages/hypergraph/src/utils/relation-query-helpers.ts Updates query builders to accept SpaceSelectionMode and generate appropriate filters
packages/hypergraph/src/entity/find-many-public.ts Integrates space selection into the main query function with dynamic variable definitions
packages/hypergraph/src/entity/find-one-public.ts Updates to pass 'single' mode to relation query builders
packages/hypergraph/src/entity/search-many-public.ts Updates to pass 'single' mode to relation query builders
packages/hypergraph-react/src/internal/types.ts Simplifies type definition by reusing FindManyPublicParams
packages/hypergraph-react/src/internal/use-entities-public.tsx Handles space selection in React query hook
packages/hypergraph-react/src/hooks/use-entities.tsx Adds support for spaces parameter with context fallback
packages/hypergraph-react/src/hooks/use-entities-public-infinite.ts Extends infinite scroll hook to support multi-space queries
apps/events/src/schema.ts Adds Space entity schema for testing
apps/events/src/routes/podcasts.lazy.tsx Demonstrates usage with spaces: 'all' option
.changeset/shy-bugs-obey.md Documents the new feature

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

backlinksTotalCountsTypeId1: '972d201a-d780-4568-9e01-543f67b26bee',
});

console.log({ data, isLoading, isError });

Copilot AI Dec 3, 2025

Copy link

Choose a reason for hiding this comment

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

Debug console.log statement should be removed before merging to production. This log was added as part of testing the new multi-space functionality.

Suggested change
console.log({ data, isLoading, isError });

Copilot uses AI. Check for mistakes.
Comment on lines +86 to +87
console.log('spaces', spaces);

Copilot AI Dec 3, 2025

Copy link

Choose a reason for hiding this comment

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

Debug console.log statement should be removed before merging to production. This log was added to test the new spaces: 'all' functionality.

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

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +7
Add support for querying public entities across multiple spaces (including an `all` scope) and expose the new API through the React hooks

No newline at end of file

Copilot AI Dec 3, 2025

Copy link

Choose a reason for hiding this comment

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

Remove trailing whitespace at the end of the line.

Suggested change
Add support for querying public entities across multiple spaces (including an `all` scope) and expose the new API through the React hooks
Add support for querying public entities across multiple spaces (including an `all` scope) and expose the new API through the React hooks

Copilot uses AI. Check for mistakes.
@@ -187,18 +237,26 @@ export const findManyPublic = async <S extends Schema.Schema.AnyNoContext>(
}

// Build the query dynamically with aliases for each relation type ID

Copilot AI Dec 3, 2025

Copy link

Choose a reason for hiding this comment

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

This comment is duplicated on line 242. Consider updating this comment to describe the space selection normalization (e.g., "Normalize space selection from params") and keeping the existing comment on line 242 for the query building.

Suggested change
// Build the query dynamically with aliases for each relation type ID
// Normalize space selection from params

Copilot uses AI. Check for mistakes.
@nikgraf
nikgraf merged commit 40111af into main Dec 3, 2025
12 checks passed
@nikgraf
nikgraf deleted the nik/multi-spaces-filter branch December 3, 2025 19:00
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