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
For some reason my queries to fetch my data based on my data models are not working. At some point i was able to read the data from one of my two schemas but for some reason it didn't last long now I'm back to fetching null datas on both schemas. My app code is up to date pulled and pushed to make sure that the data on the cloud were up to date. I don't think anything is wrong with my syntax cause if it were the case I would have never been able to even get some results on of my schemas, authentication is also good, schema data are matching on all sides so I don't get why I when i try to fetch datas I get nothing ...
Expected behavior
I just want to be able to fetch my "list of products" = data to render them on my homepage through a custom component in a flatlist
Reproduction steps
i just make my query on my homepage, datastore and the needed schemas are imported, im using a useEffect and useState, tried with async and without always get the same result
Code Snippet
// Put your code below this line.import{DataStore}from"aws-amplify/datastore";import{Brand,Product}from"../../../../src/models";// Import Product modelconst[products,setProducts]=useState([]);useEffect(()=>{DataStore.query(Product).then(setProducts)},[]);constrenderProductItem=({ item })=>(<TouchableOpacityonPress={()=>handleProductPress(item)}style={styles.flatListContainer}><Viewstyle={styles.itemContainer}><ClothCardproductData={item}onPressProductCard={handleProductPress}/></View></TouchableOpacity>);____________________downhereismyClothCardcomponentcodeforreferenceimportReactfrom"react";import{Text,View,TouchableOpacity,Image,StyleSheet,Dimensions}from"react-native";constscreenWidth=Dimensions.get("window").width;exportdefaultfunctionClothCard({ productData, onPressProductCard }){const{ name, brandID, price, image, description }=productData;// Calculate the width of each card based on screen width and desired spacingconstcardWidth=(screenWidth-20)/2;// Assuming 10px spacing between cardsreturn(<TouchableOpacityonPress={()=>onPressProductCard(productData)}><Viewstyle={[styles.cardView,{width: cardWidth}]}><Imagestyle={styles.imageCard}source={image}/><Viewstyle={styles.textBox}><Textstyle={styles.productText}>{brandID} - {name}</Text><Textstyle={styles.priceText}>${price}</Text></View></View></TouchableOpacity>);}
### Logoutput<details>
// Put your logs below this line
</details>
### aws-exports.js
_No response_
### Manual configuration
_No response_
### Additional configuration
_No response_
### 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:
@PopeSilk - thanks for opening this ticket! Can you please share the following with us so we can better understand / reproduce the issue?
Your schema
A code snippet demonstrating how you are creating records
Logs demonstrating the output of your calls to DataStore.save
A code snippet demonstrating how / where you are configuring Amplify and / or DataStore?
Any other relevant logging that could help us understand / reproduce the issue?
Additionally, could you try calling await DataStore.query within a try / catch block outside of useEffect (i.e. by adding a button to the page that you can use to trigger this call after the app has loaded)?
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication, GraphQL API, DataStore
Amplify Version
v6
Amplify Categories
auth, storage, api
Backend
Amplify CLI
Environment information
Describe the bug
For some reason my queries to fetch my data based on my data models are not working. At some point i was able to read the data from one of my two schemas but for some reason it didn't last long now I'm back to fetching null datas on both schemas. My app code is up to date pulled and pushed to make sure that the data on the cloud were up to date. I don't think anything is wrong with my syntax cause if it were the case I would have never been able to even get some results on of my schemas, authentication is also good, schema data are matching on all sides so I don't get why I when i try to fetch datas I get nothing ...
Expected behavior
I just want to be able to fetch my "list of products" = data to render them on my homepage through a custom component in a flatlist
Reproduction steps
i just make my query on my homepage, datastore and the needed schemas are imported, im using a useEffect and useState, tried with async and without always get the same result
Code Snippet
// Put your logs below this line
The text was updated successfully, but these errors were encountered: