Documentation Improvement by adding an example and description for initialEvent for custom subscriptions
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 38/100
- Issue 類型
- 文件
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- graphql, javascript
- 領域
- api, documentation
研究方向
首先找到自訂 subscription 文件,以及現有的 @pgSubscription 和 currentUserTopicFromContext 範例。為 initialEvent 撰寫文件,包括其函式簽章和所示的連線建立範例;當讀者能夠理解如何提供它,以及傳回的物件控制什麼時,即可視為完成。
由索引模型根據 Issue 內容生成。
描述
Over the last few days I've been trying to create a custom subscription that sends the data directly after connecting. However, there is no example in the documentation of an initial event or any evidence that there is an interface for it. The default behavior of an custom subscription is that it only fetches the previous data and the new data (on insert) after an event was been triggered on the database side.
I only got the information about the initialEvent from the discord server:
- By providing the
initialEventargument to@pgSubscription(...)intypeDefsyou can pass to it the function which you want to be executed on connection establishment the same way ascurrentUserTopicFromContextfrom the docs to topic:
currentUserUpdated: UserSubscriptionPayload @pgSubscription(topic: ${embed(
currentUserTopicFromContext,
)})
with initialEvent:
currentUserUpdated: UserSubscriptionPayload @pgSubscription(topic: ${embed(
currentUserTopicFromContext,
)}, initialEvent: ${embed(
onInitialEvent, //the function that you want to be executed
)})
The function that you want to be executed in initialEvent has the same structure as currentUserTopicFromContext:
const onInitialEvent = async (_args, context, _resolveInfo) => {
// do something
return {}; // return an object
}
Now because returning an empty object was the solution for my problem (get already existing data on connection establishment), I didn't dig any deeper on what arguments I can give to the object to control the behavior and what operations can be done in the initialEvent function. This can be added additionally to the documentation.
Adding description for initialEvent and examples for it to the documentation to make it clear that something like that exists would help allot.
- 主要語言
- SCSS
- 星號
- 27
- 分支
- 124
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
graphile/graphile.github.io 的其他 Issue
-
website: Update details on homepage and sponsor page可能重新可做 @jemgillam 於 1119 天前認領,目前沒有進行中的 PR。 未關閉quick
graphile/graphile.github.io#399 · 4 則留言 · 已指派 1 人 ·
-
sponsor page: New wording around Grafast needed!可能重新可做 @jemgillam 於 1149 天前認領,目前沒有進行中的 PR。 未關閉
graphile/graphile.github.io#393 · 1 個 reaction · 已指派 1 人 ·
-
難度 2/5 1-3 小時 新手友好度 38/100
graphile/graphile.github.io#341 · 1 個 reaction ·
-
難度 2/5 1-3 小時 新手友好度 25/100
graphile/graphile.github.io#280 · 2 則留言 · 5 個 reaction ·
-
難度 5/5 一週以上 新手友好度 25/100
graphile/graphile.github.io#273 · 2 則留言 ·
查看 graphile/graphile.github.io 的全部 Issue
相似的 Issue
-
Bug: fenced drafts inside <think> tags break parsing or are returned instead of the answer可能已有人在做 @aad1tyaaaaa 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
google/langextract#639 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100
Niko1221/Strata#7211 · 3 則留言 ·
維護者通常 5 天內回覆
-
Team: SCM
難度 2/5 1-3 小時 新手友好度 78/100
microsoft/BCApps#14569 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
directus/directus#28558 · 1 則留言 ·
維護者通常 2 天內回覆