You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when passing arguments via variables the subscription resolver receives args correctly. If the variables aren't used and hardcoded to the query the subscription resolver gets an empty object.
This modification to src/__tests__/subscription.test.ts will demonstrate
Changed the query from
subscription ($priority: Int = 0) {
importantEmail(priority: $priority) {
email {
from
subject
}
inbox {
unread
total
}
}
}
to
subscription {
importantEmail(priority: 0) {
email {
from
subject
}
inbox {
unread
total
}
}
}
and added expect(args).toEqual({"priority": 0})
function createSubscription(pubsub: SimplePubSub<Email>) {
const document = parse(`
subscription {
importantEmail(priority: 0) {
email {
from
subject
}
inbox {
unread
total
}
}
}
`);
const emails = [
{
from: "[email protected]",
subject: "Hello",
message: "Hello World",
unread: false
}
];
const inbox = { emails };
const QueryType = new GraphQLObjectType({
name: "Query",
fields: {
inbox: { type: InboxType, resolve: (...args) => {
return emails
} }
}
});
const emailSchema = new GraphQLSchema({
query: QueryType,
subscription: new GraphQLObjectType({
name: "Subscription",
fields: {
importantEmail: {
type: EmailEventType,
args: {
priority: { type: GraphQLInt }
},
// FIXME: we shouldn't use mapAsyncIterator here since it makes tests way more complex
subscribe(root,args) {
return pubsub.getSubscriber((newEmail) => {
expect(args).toEqual({"priority": 0})
emails.push(newEmail);
return {
importantEmail: {
email: newEmail,
inbox
}
};
});
}
}
}
})
});
The text was updated successfully, but these errors were encountered:
I cannot tell this for certain, but it is likely mutations have the same problem. At least I remember we have JIT handling disabled for both subscriptions and mutations, and the cause was likely the same. Cannot tell this for certain - it's been a while since we encountered it. :(
Is there any update regarding this issue? We have runned graphql-jit with subscriptions (and mutations) disabled for the past few years, but it would be great to have them supported.
We might be able to contribute to a fix, but need a few pointers from the original authors to get started.
It would be great to get a contribution to a fix. The initial message has an example test case for subscriptions, and it would be a good start to provide a failing test for the subscription and/or mutation case in a draft PR, for example.
when passing arguments via variables the subscription resolver receives args correctly. If the variables aren't used and hardcoded to the query the subscription resolver gets an empty object.
This modification to
src/__tests__/subscription.test.ts
will demonstrateChanged the query from
to
and added
expect(args).toEqual({"priority": 0})
The text was updated successfully, but these errors were encountered: