graphprotocol / graphprotocol/hypergraph
Async functions for querying public graph
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 22
- Fork
- 12
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Currently the only way to query the public graph using a specific schema is to go through Hypergraph's client-side useQuery hook. This works well when you need to modify the data, as we can keep the source of truth for queried data in the same place as modified data.
There are some use-cases where you just need to query for public data but not modify it. For this use case useQuery still works, but it won't work for server-side rendering or ad-hoc queries that run as a result of side-effects.
We should expose the query internals in a separate query(Schema) function.
Query options
Queries require things like the mapping or the space in order to generate the query + filters for a specific schema. We'll need a way to provide these options to the query at query time.
Option 1
We can pass the options to the query directly.
await query(Address, { mapping, spaceId })
Option 2
We can create a QueryClient which accepts options. Not entirely sure but this probably looks similar to hypergraph/react's internal context for spaces.
const client = new HypergraphClient({ mapping, spaceId });
await client.query(Address)
Appendix
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dall’implementazione interna collegata nell’appendice, packages/hypergraph-react/src/internal/use-query-public.tsx alla riga 384, e traccia come useQuery costruisce query di schema, mapping, space e filtri. Confronta i due design di opzioni proposti per fornire mapping e spaceId, quindi definisci l’entry point per le query asincrone per il rendering lato server e le query con effetti collaterali. Il lavoro è completato quando è possibile interrogare i dati pubblici del grafo senza l’hook useQuery di React.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- api
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100