Open swyxio opened 4 years ago
this exists in Hub but is not yet documented https://github.com/aws-amplify/amplify-js/issues/4808#issuecomment-640574885
In my opinion, I think DataStore.observe
should indicate whether the record is a REMOTE or LOCAL.
I've feedback this suggestion to @manueliglesias under #6322 and I believe he's working towards the same goal.
Yeah, could we get the Hub listener for DataStore documented please :)
Confirmed docs have been added -> https://docs.amplify.aws/lib/datastore/datastore-events/q/platform/js
@mauerbac the docs are a stopgap - this is a feature request for a first class api that doesnt involve Hub.
Is this feature request dead in the water?
imo, no - @mauerbac do you mind reopening this? the documentation was only one small part. the developer experience is still not good enough if we are asking people to listen to Hub
for such a basic item. i think you and i are agreed on that, remains to be seen if the maintainers agree.
we touched upon this in today's Amplify With Friends livestream. usecase from user:
The use case: On facebook, when you're offline and u try to post smth, it will indicate it will be posted later
Late to the party, but was just searching the docs for exactly this feature. Hope we can get this implemented.
Use case: My client want to go offline for long periods of time on his tablet. He will stay signed in but open/close the (web-)app frequently. When he eventually logs out, it would be great with an easy request to the local Datastore to make sure that there are no pending items that are waiting to try synchronization to DynamoDB.
Is your feature request related to a problem? Please describe.
it's a very common need to want to indicate the sync status of datastore items. i understand its a distsys issue. but we need to offer some sort of documentation or blessed path for people to show whether something has been "synced to cloud" or is really "local only and can be lost" eg during a model migration.
we seem to have this process here that quite honestly i dont understand (what am i executing "against the remote state"?): https://docs.amplify.aws/lib/datastore/sync/q/platform/js#update-and-delete-with-predicate
Either we do it for people and warn of edge cases, or they do it themselves and do it badly.
Describe the solution you'd like
check a field or run a method.
MYMODELINSTANCE.isSynced() === true
or falseDescribe alternatives you've considered
firebase uses a CompletionListener callback https://stackoverflow.com/a/48565275/1106414
Additional context
Jameson says: