Skip to content

Conversation

nikgraf
Copy link
Collaborator

@nikgraf nikgraf commented Sep 12, 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 refactors the entity querying functionality by removing the useQueryEntity hook and introducing a new unified useEntity hook. The new hook supports both private and public query modes through a unified interface.

  • Replaces useQueryEntity with a new useEntity hook that supports both private and public entity fetching
  • Adds a new useEntityPublic internal hook for querying entities from the public GraphQL API
  • Updates the findOne function's include parameter type to support nested relation specifications

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/hypergraph/src/entity/findOne.ts Updates include parameter type to support nested relations
packages/hypergraph-react/test/HypergraphSpaceContext.test.tsx Updates test imports and usage from useQueryEntity to useEntity
packages/hypergraph-react/src/internal/use-query-public.tsx Removes duplicate type annotation comment from array spread operation
packages/hypergraph-react/src/internal/use-entity-public.tsx Adds new public entity querying functionality with GraphQL integration
packages/hypergraph-react/src/index.ts Updates exports to replace useQueryEntity with useEntity and adds useEntityPublic
packages/hypergraph-react/src/HypergraphSpaceContext.tsx Refactors useQueryEntity into useEntityPrivate and adds new unified useEntity hook
apps/events/src/routes/playground.lazy.tsx Adds Event component usage to demonstrate new functionality
apps/events/src/components/event.tsx Creates new Event component using the useEntity hook in public mode
.changeset/yummy-beans-float.md Documents the hook replacement as a minor version change
.changeset/wise-mugs-swim.md Documents the include type improvement as a patch

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

__version: '',
});

console.log({ component: 'parseResult', decodeResult });
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

Console.log statement should be removed from production code. Consider using a proper logging mechanism or removing this debug statement.

Suggested change
console.log({ component: 'parseResult', decodeResult });

Copilot uses AI. Check for mistakes.

Comment on lines +251 to +255
rawEntity[key] = [
// @ts-expect-error TODO: properly access the type.name
...rawEntity[key],
...newRelationEntities,
];
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

The @ts-expect-error comment indicates a type issue that should be properly addressed. This duplicates the same pattern that was cleaned up in use-query-public.tsx and should use the same simplified approach.

Copilot uses AI. Check for mistakes.

@nikgraf nikgraf merged commit 604724b into main Sep 12, 2025
5 of 6 checks passed
@nikgraf nikgraf deleted the ng/use-entity branch September 12, 2025 16:33
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