DataStore subscriptionDataProcessed event is dispatched twice
Before opening, please confirm:
- [X] I have searched for duplicate or closed issues and discussions.
Language and Async Model
Java, Kotlin
Amplify Categories
DataStore
Gradle script dependencies
// Put output below this line
Environment information
# Put output below this line
Please include any relevant guides or documentation you're referencing
No response
Describe the bug
Observed from testing with amplify-flutter.
When a GraphQL subscription event arrives, after processing merge the data into local DB, subscriptionDataProcessed event gets dispatched twice via DataStore hub event channel.
It looks like that this spot were executed twice during the merge process following this order: by 1) here and 2) here
According to the source code and code commends, subscriptionDataProcessed event is dispatched on a successful data merge, which should be dispatched only once. Could you confirm if the current behavior is correct?
Additional context: amplify-ios emits a simple event syncReceived after the merging process triggered by a GraphQL subscription event. And syncReceived event gets dispatched once.
Reproduction steps (if applicable)
- Trigger a GraphQL subscription from any valid source
- Observe
subscriptionDataProcessedevent on DataStore hub
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
amplifyconfiguration.json
No response
GraphQL Schema
// Put your schema below this line
Additional information and screenshots
No response