Subscription not working when condition input
See original GitHub issueSchema & Subscription
type HubFleet @model
@key(fields: [ "PK", "SK" ])
@key(name: "GSI1", fields: [ "GSI1","GSISK1" ], queryField: "GSI1")
@key(name: "GSI2", fields: [ "GSI2","GSISK2" ], queryField: "GSI2")
@key(name: "GSI3", fields: [ "GSI3","GSISK3" ], queryField: "GSI3")
{
id: ID!
PK: String!
SK: String!
GSI1: String
GSISK1: String
GSI2: String
GSISK2: String
GSI3: String
GSISK3: String
}
input ModelStringKeyConditionInput {
eq: String
le: String
lt: String
ge: String
gt: String
between: [String]
beginsWith: String
}
type Subscription {
subscribeCreateHubFleetByOrg(GSI1:String!,GSISK1:ModelStringKeyConditionInput): HubFleet @aws_subscribe(mutations: ["createHubFleet"])
subscribeUpdateHubFleetByOrg(GSI1:String!,GSISK1:ModelStringKeyConditionInput): HubFleet @aws_subscribe(mutations: ["updateHubFleet"])
subscribeDeleteHubFleetByOrg(GSI1:String!,GSISK1:ModelStringKeyConditionInput): HubFleet @aws_subscribe(mutations: ["deleteHubFleet"])
}
subscription query
export const subscribeCreateHubFleetByOrg = /* GraphQL */ `
subscription SubscribeCreateHubFleetByOrg(
$GSI1: String!
$GSISK1: ModelStringKeyConditionInput
) {
subscribeCreateHubFleetByOrg(GSI1: $GSI1, GSISK1: $GSISK1) {
id
PK
SK
GSI1
GSISK1
GSI2
GSISK2
GSI3
GSISK3
}
}
using it in react app
import { subscribeCreateHubFleetByOrg } from './graphql/subscriptions';
import gql from 'graphql-tag';
import { useSubscription } from 'react-apollo';
const CUSTOM_ADD_DATA_SUBSCRIPTION = gql`${subscribeCreateHubFleetByOrg}`;
useSubscription(CUSTOM_ADD_DATA_SUBSCRIPTION, {
variables: { GSI1:"VALUE", GSISK1: { beginsWith: 'ORG#' } },
onSubscriptionData: ({ client, subscriptionData }) => { debugger; handleUpdateTodo(client, subscriptionData) }
});
when i use with conditional input then it’s not works but when i use it without conditional input then it’s works
useSubscription(CUSTOM_ADD_DATA_SUBSCRIPTION, {
variables: { GSI1:"VALUE"},
onSubscriptionData: ({ client, subscriptionData }) => { debugger; handleUpdateTodo(client, subscriptionData) }
});
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Subscribe not being triggered when the subject values changes
log("input value ", data); });. Service is receiving new value but the subscription in component B is not being triggered.. what am I...
Read more >Subscriptions - Apollo GraphQL Docs
Like queries, subscriptions enable you to fetch data. Unlike queries, subscriptions are long-lasting operations that can change their result over time. They can ......
Read more >GraphQL specification
If a GraphQL server expects a scalar type as input to an argument, coercion is observable and the rules must be well defined....
Read more >Using CloudWatch Logs subscription filters
You can use a subscription filter with Kinesis, Lambda, or Kinesis Data Firehose. Logs that are sent to a receiving service through a...
Read more >6 Ways to Unsubscribe from Observables in Angular
If a subscription is not closed the function callback attached to it will be continuously called, this poses a huge memory leak and ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@lochawala Gotcha. I will try to reproduce this tomorrow.
This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels for those types of questions.