Documentation Improvement by adding an example and description for initialEvent for custom subscriptions
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- graphql, javascript
- Lĩnh vực
- api, documentation
Hướng nghiên cứu
Bắt đầu bằng cách tìm tài liệu về subscription tùy chỉnh và các ví dụ hiện có về @pgSubscription và currentUserTopicFromContext. Tài liệu hóa initialEvent, bao gồm chữ ký hàm của nó và ví dụ thiết lập kết nối được cung cấp; hoàn thành khi người đọc có thể hiểu cách cung cấp nó và đối tượng được trả về kiểm soát điều gì.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- SCSS
- Star
- 27
- Fork
- 124
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của graphile/graphile.github.io
-
website: Update details on homepage and sponsor pageCó thể làm lại được @jemgillam đã nhận 1119 ngày trước và không có pull request nào đang mở. Đang mởquick
graphile/graphile.github.io#399 · 4 bình luận · 1 người được giao ·
-
sponsor page: New wording around Grafast needed!Có thể làm lại được @jemgillam đã nhận 1149 ngày trước và không có pull request nào đang mở. Đang mở
graphile/graphile.github.io#393 · 1 reaction · 1 người được giao ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
graphile/graphile.github.io#341 · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
graphile/graphile.github.io#280 · 2 bình luận · 5 reaction ·
-
Postgraphile Sandbox/PlaygroundĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
graphile/graphile.github.io#273 · 2 bình luận ·
Tất cả issue của graphile/graphile.github.io
Issue tương tự
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
dsx-ai-factory/health-validation#368 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Tripstack-Corp/spyc#1352 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
vllm-project/vllm#70030 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
help wanted small extra
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày