graphprotocol / graphprotocol/hypergraph
Async functions for querying public graph
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 22
- Forks
- 12
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der im Anhang verlinkten internen Implementierung packages/hypergraph-react/src/internal/use-query-public.tsx in Zeile 384 und verfolge, wie useQuery Schemaabfragen, Mappings, Spaces und Filter erstellt. Vergleiche die beiden vorgeschlagenen Optionsdesigns zur Bereitstellung von mapping und spaceId, und definiere dann den asynchronen Abfrageeinstiegspunkt für serverseitiges Rendering und Abfragen mit Seiteneffekten. Als erledigt gilt die Aufgabe, wenn öffentliche Graphdaten ohne den React-useQuery-Hook abgefragt werden können.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- api
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100