#Request for image between routers

53 messages ยท Page 1 of 1 (latest)

plush cave
#

I have simple app
https://test-git-main-karina1703.vercel.app/
When I routing between pages, there is a request for an image, shouldn't this be cached?

My image looks like that

<Image src="/next.svg" width={100} height={100} alt="next"></Image>
keen gazelleBOT
#

๐Ÿ”Ž This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

๐Ÿ•ต๏ธ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

โœ… You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

sacred wharf
#

from the screenshot we cannot tell, network debug tool may show a request even when it hits the cache

viscid merlin
#

It seems like it is cached by vercel cdn but not cached by the browser

hollow pasture
#

i can't reproduce this with that link, it fetches it once and then no more even when clicking "dish123" and "home"

#

are you using dev mode to get that screenshot?

plush cave
hollow pasture
#

i am using firefox if that means anything...

#

ill check edge (basicly chrome)

#

ahh yes i do see this now

plush cave
hollow pasture
#

some reason it has the no cache headers on the result:

Cache-Control: no-cache
#

are you not using optiomised images form next/image

hollow pasture
#

im assuming your using public folder to store the svg

plush cave
#

import Image from "next/image";
import Link from "next/link";
import React from "react";

const page = () => {
return (
<div>
<Link href="dish/123">Dish 123</Link>
<Image src="/next.svg" width={100} height={100} alt="next"></Image>
</div>
);
};

export default page;

hollow pasture
#

well, this seems like vercel isn't caching it, so i don't know of anything that can help you, sorry

plush cave
#

thank you!

hollow pasture
#

but thats old so idk (i haven't tested it)

plush cave
hollow pasture
#

yeah i didn't expect it to work, but heppy to try and help ๐Ÿ™‚

hollow pasture
#

@plush cave whatever your update was (it looks diferent now), my chrome isn't requesting it after page change (just the inital time)

plush cave
#

I have new Version 116.0.5845.96 (Official Build) (arm64)

hollow pasture
#

uhh Microsoft Edge: Version 116.0.1938.54 (Official build) beta (64-bit)

#

i don't see how that would change much tho

plush cave
#

hmm

viscid merlin
hollow pasture
#

yeah i think it is working now ๐Ÿ™‚

plush cave
#

but this is not the best user experience - every time we request an image

viscid merlin
plush cave
viscid merlin
#

I find it pretty nice from an app standing point. Your image responds in less than 20-50ms most of the time and you can control caching behavior from the CDN easily

hollow pasture
#

yeah they now send 304 Not Modified for me (my issue was that I forgot to disable "disable cache" in chrome)

plush cave
#

but I have the same problem in safari

#

But not in chrome ๐Ÿ™‚

hollow pasture
#

well then its not proabibly nextjs/vercels issue but safari lolsob

plush cave
plush cave
hollow pasture
#

so i think you can mark this as solved?

plush cave
#

ahah

hollow pasture
# keen gazelle

just folow this guide and choose any message that is the "answer"...

keen gazelleBOT
#
โœ… Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer
#
โœ… Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer
plush cave