-
Notifications
You must be signed in to change notification settings - Fork 8
remove useQueryEntity and add useEntity hook #532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 newuseEntity
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 }); |
Copilot
AI
Sep 12, 2025
There was a problem hiding this comment.
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.
console.log({ component: 'parseResult', decodeResult }); |
Copilot uses AI. Check for mistakes.
rawEntity[key] = [ | ||
// @ts-expect-error TODO: properly access the type.name | ||
...rawEntity[key], | ||
...newRelationEntities, | ||
]; |
Copilot
AI
Sep 12, 2025
There was a problem hiding this comment.
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.
No description provided.