You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Another more general question is, can I use DataStore to pre-fetch data for frontend data caching? It seems when saving the items queried from API to DataStore, the id of the item will be changed: that means I can't save the API query results into DataStore? So I guess, DataStore is only for local-first scenarios, not for date pre-fetching?
Hi @nxia416 👋 thanks for raising this issue. It seems that a field and query is missing from your schema. If you run amplify status do you see that the API resource is in Update status? Perhaps you have some changes that need to be deployed using amplify push
Also, be sure that Conflict detection is enabled by running amplify update api > GraphQL > enable conflict detection
Otherwise, try running amplify codegen models to regenerate the local model schema for DataStore.
Also, you are correct that DataStore is not intended to be used as a cache. It is for local first scenarios.
Unless you have a specific use case for offline capabilities, we recommend using the API category for the best balance of performance and reliability when interfacing with your Amplify GraphQL API.
@chrisbonifacio thanks for the response! I will try "enable conflict detection", I guess that is the missing part.
My main purpose is for javascript frontend caching. I figured out I could use import { Cache } from "aws-amplify" for that. So my problem is sovled. Thanks again.
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
DataStore
Amplify Categories
api
Environment information
Describe the bug
After added GraphQL API and Auth, I am trying to use DataStore for a frontend cache. However, I notice that DataStore keeps sending graphql requests:
The reaponse suggests the requests are all failed:
Expected behavior
fix the sync results or turn off the data syncing.
Reproduction steps
amplify codegen models
to create modelsDataStore.query
to the frontend query BlogsCode Snippet
GraphQL schema is from the official example:
Log output
aws-exports.js
Manual configuration
No response
Additional configuration
Here is my cache method:
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: