Repository navigation
remove useQueryEntity and add useEntity hook - #532
Conversation
There was a problem hiding this comment.
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
useQueryEntitywith a newuseEntityhook that supports both private and public entity fetching - Adds a new
useEntityPublicinternal hook for querying entities from the public GraphQL API - Updates the
findOnefunction'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 }); |
There was a problem hiding this comment.
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 }); |
| rawEntity[key] = [ | ||
| // @ts-expect-error TODO: properly access the type.name | ||
| ...rawEntity[key], | ||
| ...newRelationEntities, | ||
| ]; |
There was a problem hiding this comment.
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.
No description provided.