-
Notifications
You must be signed in to change notification settings - Fork 8
add createEntityPublic #240
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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 introduces a new hook, useCreateEntityPublic, to enable creating new entities on the Hypergraph. In addition to adding this hook, the PR exports it via the package index and demonstrates its usage in the events playground.
- Added the useCreateEntityPublic hook to handle entity creation with proper mapping and publishing operations.
- Updated the module index to export the new hook.
- Updated the playground component to provide a UI trigger for creating an entity.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
packages/hypergraph-react/src/internal/use-create-entity-public.ts | Implements the new hook with mapping lookups, serialization, and mutation handling. |
packages/hypergraph-react/src/index.ts | Exports the new hook to be used externally. |
apps/events/src/components/playground.tsx | Integrates the new create entity functionality into the UI via a button. |
// TODO: return the entity with this type: Promise<Entity.Entity<S>> | ||
) => { | ||
try { | ||
// @ts-expect-error TODO should use the actual type instead of the name in the mapping |
Copilot
AI
Jun 23, 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.
Consider refining the type definitions so that the actual type can be used instead of relying on @ts-expect-error. This will improve type safety and code clarity.
// @ts-expect-error TODO should use the actual type instead of the name in the mapping |
Copilot uses AI. Check for mistakes.
queryClient.invalidateQueries({ | ||
queryKey: [ | ||
'hypergraph-public-entities', | ||
// @ts-expect-error - TODO: find a better way to access the type.name |
Copilot
AI
Jun 23, 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.
Review the access to type.name and update the typing accordingly to avoid the need for an @ts-expect-error suppression. This change can enhance maintainability and type correctness.
// @ts-expect-error - TODO: find a better way to access the type.name |
Copilot uses AI. Check for mistakes.
name: 'Test Event 42 by Nik', | ||
sponsors: ['347676a1-7cef-47dc-b6a7-c94fc6237dcd'], | ||
}, | ||
// @ts-expect-error - TODO: fix the types error |
Copilot
AI
Jun 23, 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.
Consider addressing the underlying type issues in the createEntity invocation so that the @ts-expect-error suppression can be removed. Improving type safety here will increase code robustness.
Copilot uses AI. Check for mistakes.
No description provided.