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
Hi, Reacfire team I need a guide on why this is happening and how to fix this .
I am using two hooks of Reactfire useDatabaseListData to get the URLs of the images from the real-time database and useStorageDownloadURL to get and display the images.
For some reason the "for loop" ran only the first time (even if I checked the imagesarray.length in the last tried got the final list of images).
function Displayphotos(photosmetada)
{
const urlminimalblankimage="https://firebasestorage.googleapis.com/xxxxxxxxxxxxxxxxx..."
const minimalblankobject=[{"author":"","id":"07355838-54d7-436e-9bcc-6688467c2990","timestamp":"","url":urlminimalblankimage}];
if (typeof (photosmetada.photosmetada.user) !== 'undefined')
{
var gameid = photosmetada.photosmetada.gameid;
}
var database = useDatabase();
var querypath = '/photos/' + gameid;
const photosRef = refdatabase(database, querypath);
const objectlistofimages = useDatabaseListData(photosRef);
var imagesarray=objectlistofimages.data;
if (typeof (imagesarray) === 'undefined'){
imagesarray=minimalblankobject;
}
const photoRefoneimageblank = ref(storage,urlminimalblankimage);
var imagesarraylength=imagesarray.length;
for (let i=0; i < imagesarraylength;i++)
{
console.log(i);
console.log(imagesarraylength);
var urlimageref=imagesarray[i].url;
var photoRefoneimage = ref(storage,urlimageref);
var { status, data: imageURL } = useStorageDownloadURL((typeof (imagesarray) !== 'undefined') ? photoRefoneimage:photoRefoneimageblank);
if (status === 'loading')
return <span>loading...</span>;
return <img src={imageURL} alt="game NSYL" />
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, Reacfire team I need a guide on why this is happening and how to fix this .
I am using two hooks of Reactfire useDatabaseListData to get the URLs of the images from the real-time database and useStorageDownloadURL to get and display the images.
For some reason the "for loop" ran only the first time (even if I checked the imagesarray.length in the last tried got the final list of images).
Pls any guide.
Beta Was this translation helpful? Give feedback.
All reactions