Documentation Improvement by adding an example and description for initialEvent for custom subscriptions
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 38/100
- Issue-Typ
- Dokumentation
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- graphql, javascript
- Bereich
- api, documentation
Rechercherichtung
Beginne damit, die Dokumentation zu benutzerdefinierten Subscriptions sowie die vorhandenen Beispiele für @pgSubscription und currentUserTopicFromContext zu finden. Dokumentiere initialEvent, einschließlich seiner Funktionssignatur und des gezeigten Beispiels zur Verbindungsherstellung; abgeschlossen ist die Aufgabe, wenn Leser verstehen können, wie sie es bereitstellen und was das zurückgegebene Objekt steuert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- SCSS
- Sterne
- 27
- Forks
- 124
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus graphile/graphile.github.io
-
website: Update details on homepage and sponsor pageEvtl. wieder frei @jemgillam hat das vor 1119 Tagen übernommen, und es ist kein Pull Request offen. Offenquick
graphile/graphile.github.io#399 · 4 Kommentare · 1 zugewiesene Person ·
-
sponsor page: New wording around Grafast needed!Evtl. wieder frei @jemgillam hat das vor 1149 Tagen übernommen, und es ist kein Pull Request offen. Offen
graphile/graphile.github.io#393 · 1 Reaktion · 1 zugewiesene Person ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 38/100
graphile/graphile.github.io#341 · 1 Reaktion ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 25/100
graphile/graphile.github.io#280 · 2 Kommentare · 5 Reaktionen ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
graphile/graphile.github.io#273 · 2 Kommentare ·
Alle Issues in graphile/graphile.github.io
Ähnliche Issues
-
Bug: fenced drafts inside <think> tags break parsing or are returned instead of the answerEvtl. vergeben @aad1tyaaaaa hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
google/langextract#639 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Niko1221/Strata#7211 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 5 Tagen
-
[Bug]: Cannot add sales line item to sales order, on an on-prem installation with basic licenseOffenTeam: SCM
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
microsoft/BCApps#14569 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
directus/directus#28558 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen