Closed edoardo849 closed 4 years ago
@edoardo849 - Could you update to our unstable version and try if this still exists. we have introduced some major changes to datastore.
These are the unstable versions, you might need to use --save-exact due to semver's handling of build metadata
@aws-amplify/analytics@3.1.13-unstable.5
@aws-amplify/api-graphql@1.0.15-unstable.5
@aws-amplify/api-rest@1.0.15-unstable.5
@aws-amplify/api@3.1.13-unstable.5
@aws-amplify/auth@3.2.10-unstable.5
@aws-amplify/cache@3.1.13-unstable.5
@aws-amplify/core@3.2.10-unstable.5
@aws-amplify/datastore@2.1.3-unstable.5
@aws-amplify/interactions@3.1.13-unstable.5
@aws-amplify/predictions@3.1.13-unstable.5
@aws-amplify/pubsub@3.0.14-unstable.5
@aws-amplify/pushnotification@3.0.14-unstable.5
@aws-amplify/storage@3.2.3-unstable.5
@aws-amplify/ui-angular@0.2.7-unstable.9
@aws-amplify/ui-components@0.5.1-unstable.9
@aws-amplify/ui-react@0.2.8-unstable.9
@aws-amplify/ui-vue@0.2.7-unstable.9
@aws-amplify/ui@2.0.3-unstable.168
@aws-amplify/xr@2.1.13-unstable.5
amazon-cognito-identity-js@4.3.1-unstable.9
aws-amplify-angular@5.0.14-unstable.5
aws-amplify-react-native@4.2.1-unstable.9
aws-amplify-react@4.1.13-unstable.5
aws-amplify-vue@2.1.2-unstable.168
aws-amplify@3.0.14-unstable.5
I am seeing some problems in firefox and safari (working on this) but everything seems to work perfectly in chrome.
@edoardo849 My issues with firefox and safari was due my cached old indexed db. Clearing the local data and trying it again solved it.
With respect to your refresh problem, with the latest unstable version, we have introduced datastore sync status. You can make use of it for sync to happen properly.
async ngOnInit(): Promise<void> {
this.removeHubListener = Hub.listen('datastore', async ({payload: {event}}) => {
if(event === 'ready') {
await this.query();
}
});
}
ngOnDestroy(): void {
this.removeHubListener();
}
public async query() {
const predicate: typeof Predicates.ALL = Predicates.ALL;
const pagination: PaginationInput = { page: this.page, limit: this.limit };
this.notes = await DataStore.query(Note, predicate, pagination);
}
Let us know how it goes.
Hey @ashika01 thanks for your reply! I'm testing it today and will update asap how it goes :-)
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.
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 or Discussions for those types of questions.
Describe the bug Using DataStore with Angular by testing with multiple clients (different browsers): when I create an Item on browser 1 I can see the result in DynamoDB and receive an update via the local subscription on browser 1. However, the local subscription on browser 2 isn't triggered and I need to refresh the page completely on browser 2 in order to see the change performed on browser 1.
To Reproduce Steps to reproduce the behavior:
DataStore.query(...)
.Expected behavior When creating / deleting an item in browser 1, I would expect the same operation to happen automatically and in near-real-time in browser 2.
Code Snippet
backend/api/app/schema.graphql
main.ts
app.component.ts
I am running the app with
ng serve --prod
What is Configured? If applicable, please provide what is configured for Amplify CLI:
Which resources do you have configured? Api, Auth, Hosting
aws-exports
file:Environment
Additional Context
If I switch from DataStore to GraphQL only (without local sync), then the subscription works as expected and I can see the message on both browsers.
schema.graphql
app.component.ts