Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/events/src/components/playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@ export const Playground = () => {

console.log({ isLoading, isError, entityData });

return <pre className="text-xs">{JSON.stringify(entityData, null, 2)}</pre>;
return (
<div>
{isLoading && <div>Loading...</div>}
{isError && <div>Error</div>}
<pre className="text-xs">{JSON.stringify(entityData, null, 2)}</pre>
</div>
);
};
5 changes: 3 additions & 2 deletions apps/events/src/components/todos2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,9 @@ export const Todos2 = () => {
setIsPublishDiffModalOpen(false);
setPublishData(null);
setTimeout(() => {
queryClient.invalidateQueries({ queryKey: [`entities:${Todo2.name}`] });
queryClient.invalidateQueries({ queryKey: [`entities:geo:${Todo2.name}`] });
queryClient.invalidateQueries({
queryKey: ['hypergraph-public-entities', Todo2.name],
});
}, 1000);
}
} catch (error) {
Expand Down
8 changes: 4 additions & 4 deletions apps/events/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export const mapping: Mapping = {
typeIds: [Id.Id('4d876b81-787e-41fc-ab5d-075d4da66a3f')],
properties: {
name: Id.Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
description: Id.Id('9b1f76ff-9711-404c-861e-59dc3fa7d037'),
},
relations: {
any: Id.Id('8f151ba4-de20-4e3c-9cb4-99ddf96f48f1'),
// description: Id.Id('9b1f76ff-9711-404c-861e-59dc3fa7d037'),
},
// relations: {
// any: Id.Id('8f151ba4-de20-4e3c-9cb4-99ddf96f48f1'),
// },
},
// Todo2: {
// typeIds: [Id.Id('LJuM8ju67mCv78FhAiK9k9')],
Expand Down
4 changes: 2 additions & 2 deletions apps/events/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class RelationEntry extends Entity.Class<RelationEntry>('RelationEntry')(

export class Event extends Entity.Class<Event>('Event')({
name: Type.Text,
description: Type.Text,
// description: Type.Text,
// publishDate: Type.Text,
any: Type.Relation(RelationEntry),
// any: Type.Relation(RelationEntry),
}) {}
10 changes: 6 additions & 4 deletions packages/hypergraph-react/src/internal/use-query-public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import { GEO_API_TESTNET_ENDPOINT } from './constants.js';
import type { QueryPublicParams } from './types.js';

const entitiesQueryDocument = gql`
query entities($spaceId: String!) {
entities(spaceId: $spaceId, filter: {}) {
query entities($spaceId: String!, $typeIds: [String!]!) {
entities(spaceId: $spaceId, filter: {
types: { in: $typeIds }
}) {
id
name
values {
Expand Down Expand Up @@ -177,11 +179,11 @@ export const useQueryPublic = <S extends Entity.AnyNoContext>(type: S, params?:
}

const result = useQueryTanstack({
queryKey: [`entities:geo:${typeName}`],
queryKey: ['hypergraph-public-entities', typeName, space, mappingEntry?.typeIds],
queryFn: async () => {
const result = await request<EntityQueryResult>(GEO_API_TESTNET_ENDPOINT, entitiesQueryDocument, {
spaceId: space,
typeId: mappingEntry?.typeIds[0],
typeIds: mappingEntry?.typeIds || [],
relationTypeIds,
});
return result;
Expand Down
Loading