feat(pg-pubsub): add option to immediately get a result on listen#812
feat(pg-pubsub): add option to immediately get a result on listen#812benjie merged 2 commits intographile:v4from
Conversation
benjie
left a comment
There was a problem hiding this comment.
Seems like a reasonable feature to add 👍
| topic: { | ||
| type: new GraphQLNonNull(GraphQLString), | ||
| }, | ||
| immediate: { |
There was a problem hiding this comment.
The word immediate here is a little confusing - without reading the docs (which don't appear in Explorer, for example), it feels like you should set it because you want to immediately listen ("Why wouldn't I want to listen immediately?!").
We need a name for this that more intuitively encompasses what it does. I'm not super happy with initialEvent because it feels like rather than being a boolean it should be an input object to specify the initial event (I do not want to do this!). But includeInitialEvent/triggerInitialEvent/triggerEventOnStart/withStartEvent/withInitialEvent/eventOnInit/etc feel too wordy. And fireImmediately feels a bit unfriendly.
Having spent a good 5 minutes pacing the living room trying to think of a better name, right now initialEvent is my preferred name for this. But I'm sure there's a better one out there.
Naming things 🤦♂️
| immediate: { | |
| initialEvent: { |
benjie
left a comment
There was a problem hiding this comment.
Oh, GitHub didn't notify me you'd pushed another commit! Sorry about that 😬
Description
Motivation:
Pretty much the same as #612
This allows to get a live view of the user email with id 2. Without the option to immediately trigger the query, this would depend on something triggering a
NOTIFYfirst.This is a non breaking change that adds a feature, it's off by default.
It seems like the tests only check the generated schema, so I only updated that test and didn't add a new one
Regarding documentation, should I open a PR on https://github.com/graphile/graphile.github.io before this is merged?
Performance impact
This is optional and disabled by default, thus there is no performance impact
Security impact
I can't think of a scenario where this impacts security
Checklist
yarn lint:fixpasses.yarn testpasses.RELEASE_NOTES.mdfile (if one exists).