1- import { Schema , store , useGraphFramework , useSelector } from '@graphprotocol/hypergraph' ;
1+ import { store } from '@graphprotocol/hypergraph' ;
2+ import { Hypergraph , Space as HypergraphSpace } from '@graphprotocol/hypergraph-react' ;
23import { createFileRoute } from '@tanstack/react-router' ;
4+ import { useSelector } from '@xstate/store/react' ;
35
46import { DevTool } from '@/components/dev-tool' ;
57import { Todos } from '@/components/todos' ;
68import { Button } from '@/components/ui/button' ;
79import { availableAccounts } from '@/lib/availableAccounts' ;
810import { useEffect } from 'react' ;
11+ import { getAddress } from 'viem' ;
912
1013export const Route = createFileRoute ( '/space/$spaceId' ) ( {
1114 component : Space ,
@@ -14,16 +17,16 @@ export const Route = createFileRoute('/space/$spaceId')({
1417function Space ( ) {
1518 const { spaceId } = Route . useParams ( ) ;
1619 const spaces = useSelector ( store , ( state ) => state . context . spaces ) ;
17- const { subscribeToSpace, inviteToSpace, isLoading } = useGraphFramework ( ) ;
20+ const { subscribeToSpace, inviteToSpace, loading } = Hypergraph . useHypergraphApp ( ) ;
1821 useEffect ( ( ) => {
19- if ( ! isLoading ) {
22+ if ( ! loading ) {
2023 subscribeToSpace ( { spaceId } ) ;
2124 }
22- } , [ isLoading , subscribeToSpace , spaceId ] ) ;
25+ } , [ loading , subscribeToSpace , spaceId ] ) ;
2326
2427 const space = spaces . find ( ( space ) => space . id === spaceId ) ;
2528
26- if ( isLoading ) {
29+ if ( loading ) {
2730 return < div className = "flex justify-center items-center h-screen" > Loading …</ div > ;
2831 }
2932
@@ -33,7 +36,7 @@ function Space() {
3336
3437 return (
3538 < div className = "flex flex-col gap-4 max-w-screen-sm mx-auto py-8" >
36- < Schema . SpacesProvider defaultSpace = { space . id } >
39+ < HypergraphSpace . HypergraphSpaceProvider defaultSpaceId = { space . id } spaces = { [ space . id ] } >
3740 < Todos />
3841 < h3 className = "text-xl font-bold" > Invite people</ h3 >
3942 < div className = "flex flex-row gap-2" >
@@ -44,7 +47,7 @@ function Space() {
4447 onClick = { ( ) => {
4548 inviteToSpace ( {
4649 space,
47- invitee,
50+ invitee : { accountId : getAddress ( invitee . accountId ) } ,
4851 } ) ;
4952 } }
5053 >
@@ -56,7 +59,7 @@ function Space() {
5659 < div className = "mt-12" >
5760 < DevTool spaceId = { spaceId } />
5861 </ div >
59- </ Schema . SpacesProvider >
62+ </ HypergraphSpace . HypergraphSpaceProvider >
6063 </ div >
6164 ) ;
6265}
0 commit comments