aws-mobile-appsync-sdk-ios
aws-mobile-appsync-sdk-ios copied to clipboard
Cannot watch queries when offline
Describe the bug
We cannot watch queries when offline using the default cachePolicy of returnCacheDataElseFetch
. I believe that this is because the fetch returns a network error so it does not have any dependent keys. This overwrites the dependent keys from the cached data.
To Reproduce Steps to reproduce the behavior:
- Run a query when the device is connected online so that its result is cached
- Watch the same query while offline
- Run a mutation offline with an optimistic update that will update the cache for the query being watched
- The watch query result handler will not be called on the cache update
Expected behavior We would like to be able to watch queries when there is no network connection to be able to handle cache updates from a mutation's optimistic update.
Environment:
- AppSync SDK Version: 2.10.2
The answer is probably that is not supported, but I have tagged @rohandubal for a better answer of the current state of the SDK.
We're tracking this as a feature request.
Thank you for opening this issue. AWS AppSync SDK for iOS entered maintenance mode in September 2023 and will receive no further updates as of September 2024.
Please use Amplify Swift going forward. For information on upgrading to Amplify Swift, refer to the Upgrade from AppSync SDK documentation.