Documentation Improvement by adding an example and description for initialEvent for custom subscriptions
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Documentación
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- graphql, javascript
- Área
- api, documentation
Línea de trabajo
Comienza localizando la documentación sobre suscripciones personalizadas y los ejemplos existentes de @pgSubscription y currentUserTopicFromContext. Documenta initialEvent, incluida su firma de función y el ejemplo mostrado de establecimiento de la conexión; se considerará completado cuando los lectores puedan entender cómo proporcionarlo y qué controla el objeto devuelto.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- SCSS
- Estrellas
- 27
- Forks
- 124
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de graphile/graphile.github.io
-
website: Update details on homepage and sponsor pageQuizá libre de nuevo @jemgillam la tomó hace 1119 días y no hay ningún pull request abierto. Abiertoquick
graphile/graphile.github.io#399 · 4 comentarios · 1 asignado ·
-
sponsor page: New wording around Grafast needed!Quizá libre de nuevo @jemgillam la tomó hace 1149 días y no hay ningún pull request abierto. Abierto
graphile/graphile.github.io#393 · 1 reacción · 1 asignado ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 38/100
graphile/graphile.github.io#341 · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
graphile/graphile.github.io#280 · 2 comentarios · 5 reacciones ·
-
Postgraphile Sandbox/PlaygroundAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
graphile/graphile.github.io#273 · 2 comentarios ·
Todos los issues de graphile/graphile.github.io
Issues similares
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
dsx-ai-factory/health-validation#368 ·
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Tripstack-Corp/spyc#1352 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
vllm-project/vllm#70030 ·
Los mantenedores suelen responder en 1 día
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
help wanted small extra
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día