Next.js Discord

Discord Forum

<Image> the image does not appear at some point after page refresh.

Unanswered
Turkey Vulture posted this in #help-forum
Open in Discord
Turkey VultureOP
It used to work normally, but a while ago it started to load all the images and sometimes only a few.
I use Sanity CMS in the background and import the images into the <Image> tag.
Next.js version: 14.0.0. same error on 14.2 and 15.0 too.
Here is some code snippets:
export default function ImageGallery() {
    const [images, setImages] = useState<ImageType[]>([]);
    const breakpointColumnsObj = {
        default: 3,
        1100: 2,
        700: 1,
    };

    useEffect(() => {
        const fetchImages = async () => {
            const image: ImageType[] = await getGallery();
            setImages(image);
        };

        fetchImages();
    }, []);

    return (
        <div>
        <Masonry
        breakpointCols={breakpointColumnsObj}
        className="my-masonry-grid"
        columnClassName="my-masonry-grid_column">
            {images && images.map((img) => (
                <div key={img._id}>
                    <ImageModal imgLink={img.image.image} imgAlt={img.image.alt}/>
                </div>
            ))}
        </Masonry>
        </div>
    )
}


            <div
                role="button"
                tabIndex={0}
                onClick={() => setShowModal(true)}
                aria-label="Kattintson a képre a nagyításhoz"
                className="hover01"
            >
                <div>
                    <Image className='h-auto max-w-full rounded-lg' src={imgLink} alt={imgAlt} width={800} height={800} onLoad={onLoad} priority/> 
                </div>
            </div>
            {showModal && (
                <div className="modal" onClick={closeModal}>
                    <span className="close" onClick={closeModal}>
                        &times;
                    </span>
                    <div className="modal-content">
                        <Image src={imgLink} alt="Modal Image" layout="fill" objectFit="contain"/>
                    </div>
                </div>

9 Replies

Turkey VultureOP
New information thats only happen on chromium based browser, firefox and webkit works fine, you can check it on " https://noodlecat.art "
Turkey VultureOP
yeah again its me. I still try to fix it and I found another weird thing, I tried on different hosting and Its work only this error happen on Vercel platform
I could see the image
did you try in incognitor mode?
@James4u did you try in incognitor mode?
Turkey VultureOP
wow thats weird in incognito mode works fine even after lot of Hard Refresh. But still I dont understand cuz my friend checked too and after when he refreshed the page some image again missed the render and only appeared in DOM and Network. And that issue happen only on Vercel. On netlify everything works fine with same code.
it shouldn't be related to the vercel. vercel is just a hosting platform and they send the exactly the same response to the browsers whether it is chrome or firefox or safari
Turkey VultureOP
A reddit user had the same problem and we came to this determination because he had the same problem as soon as he went to Netlify everything was ok but it happens under Vercel + Chromium. https://www.reddit.com/r/nextjs/comments/1dnynon/chromium_browsers_hit_and_miss_image_rendering/
if possible try to rename the assets and re-deploy
Turkey VultureOP
I tried and same issue :/ Here is a comparison. And I installed a fresh chrome too but still not working just only on different browser or hosting.