diff --git a/src/components/members/CreatorProfileView.tsx b/src/components/members/CreatorProfileView.tsx index 2271c557..fdaa252f 100644 --- a/src/components/members/CreatorProfileView.tsx +++ b/src/components/members/CreatorProfileView.tsx @@ -71,11 +71,11 @@ export const CreatorProfileView: Component = () => { }); onMount(() => { + console.log("Mount running"); setSession(User.session); if (typeof session() === "undefined") { alert(t("messages.signIn")); } - lazyLoadAllImages(); }); createEffect(() => { @@ -85,6 +85,10 @@ export const CreatorProfileView: Component = () => { } }); + createEffect(() => { + console.log("creatorImage value:", creatorImage()); + }); + const resetPassword = () => { window.location.href = `/${lang}/password/reset`; }; @@ -266,6 +270,9 @@ export const CreatorProfileView: Component = () => { ); if (imageUrls) { setCreatorImage(imageUrls); + + console.log(creatorImage()); + lazyLoadAllImages(); } } } diff --git a/src/lib/imageHelper.tsx b/src/lib/imageHelper.tsx index 0fcb1ea3..ad9907f7 100644 --- a/src/lib/imageHelper.tsx +++ b/src/lib/imageHelper.tsx @@ -67,7 +67,9 @@ export const downloadUserImage = async (path: string) => { }; export const lazyLoadImage = (img: HTMLImageElement) => { + console.log("Lazy loading image:", img); const dataSrc = img.dataset.src; + console.log("Data set:", img.dataset); // Check if the image src is already set to data-src if (dataSrc && img.src !== dataSrc) { console.log("Original src:", img.src); @@ -96,10 +98,14 @@ export const lazyLoadImage = (img: HTMLImageElement) => { }; export const lazyLoadAllImages = () => { + console.log("Lazy loading all images..."); const images = document.querySelectorAll("img[data-src]"); + console.log("Images:", images); + console.log("Images length:", images.length); images.forEach((img) => { const imageElement = img as HTMLImageElement; + console.log("Image:", imageElement); // Check if the image has already loaded (in case of caching) if (imageElement.complete) {