Skip to content

Conversation

nikgraf
Copy link
Collaborator

@nikgraf nikgraf commented Jun 23, 2025

No description provided.

@nikgraf nikgraf self-assigned this Jun 23, 2025
@nikgraf nikgraf requested a review from Copilot June 23, 2025 12:12
Copy link

vercel bot commented Jun 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hypergraph-connect ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 0:12am
hypergraph-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 0:12am

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 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
Copy link

Copilot AI Jun 23, 2025

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.

Suggested change
// @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
Copy link

Copilot AI Jun 23, 2025

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.

Suggested change
// @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
Copy link

Copilot AI Jun 23, 2025

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.

@nikgraf nikgraf merged commit aab8eed into main Jun 23, 2025
7 checks passed
@nikgraf nikgraf deleted the ng/add-create-entity-public branch June 23, 2025 12:22
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