Async functions for querying public graph

オープン
#438 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
typescript
領域
api

調査の方向性

付録でリンクされている内部実装 packages/hypergraph-react/src/internal/use-query-public.tsx の384行目から始め、useQuery がスキーマクエリ、mapping、space、フィルターをどのように構築するかを追跡します。mapping と spaceId を指定するために提案されている2つのオプション設計を比較し、その後、サーバーサイドレンダリングおよび副作用を伴うクエリのための非同期クエリエントリポイントを定義します。React の useQuery フックなしでパブリックグラフデータをクエリできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
TypeScript
スター
22
フォーク
12
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

graphprotocol/hypergraph のほかの issue

graphprotocol/hypergraph の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。