#Is there a way to view updated content after a modification without disable the browser cache?
43 messages · Page 1 of 1 (latest)
Does this question apply to just dev mode, or preview/production mode as well?
Can you share the code of how the image is being imported and rendered?
Hi @pale perch this is the code. The image url never change but image is override in supabase but not immediatly
Here is the function call
I use npm run serve , this is in package.json , "serve": "node server/entry.express".
hard reload not hot reload sorry
I retrieve the data from supabase with routLoader and pass the response as props to the ShopProducts component. I display the image url from the props.
Ok so if you have the option to upload the image to a new location each time, that might be best. That way each version of the image has a different URL and when the url updates, it loads the new image. If that's not possible, something to try would be to use a cache busting parameter like /my-url.jpg?v=3. Each time the image/product changes, even if the old v=2 was cached for example, seeing v=3 would force the browser to load new content.
If the product already stores the "lastModified" date, you could just use that for example, as long as reuploading an image changes that value as well.
I had already considered adding a parameter in the query string. The problem is that when I change the path, the data related to the changed product, such as the product title, description, price, etc., are updated only on the second click on the <Link>
This happens regardless of the image
Ok so not just image, but other data returned from the useProducts hook is also showing as stale?
If console.log(shop) inside useProducts is updated, but console.log(products) inside the component is not updated until I call the '/shop' path a second time.
Imagine name are generated based on the contents of the images but you can also just change the file path for them
Is the replaceImageInBucket function being invoked through a routeAction?
no
But are you referring to Qwik or how Supabase saves the image names?
I could be wrong but I think the only way to refresh data from a routeLoader is to reload/navigate or to submit a routeAction
I’m talking about qwik
ok, this is my image path https://oukztwgobbpvjuhlvpft.supabase.co/storage/v1/object/public/shop/8d1ab08d-f085-4ae2-be81-70ff4f812dd8/6a86257d-a768-4068-967f-d90a2a0d5411 in supabase that I used in qwik. How can I change the file path
now I replace the image with another at the same path.
Before you can see the new image, you need to refresh the browser one or more times.
If you open it in the browser, you will see a different image.
Oh then it’s a supabase then which I don’t know
Thank you very much anyway.
do you mean this ? const nav = useNavigate(); await nav('/shop')
I mean it could tell us something if it does work
If i use await nav('/shop'); to redirect page is not updated
Were you expecting to see the image update, or also the description, etc?
Did you see a new q-data.json fetch in the network tab?
if I click shop in the navigation menu the first time i receive old data (snippet_2.png), if I click shop in the navigation menu the second time I receive update data (snippet_3.png). I should receive them updated immediately.
Just a normal reload with the "disable cache" checkbox checked should work
no need to hard reload no?
And from the logs you mentioned on shop, are those appearing at the expected times and showing the expected data? Are there cache headers set in the network tab that could cause the browser to reuse old responses?
may I ask why do you want to avoid disabling the cache?
Or did you mean disabling it through the cacheControl api?
It takes a lot of time to update the image, normal reload works to update text
do you mean this ?
After modifying the product, I would like to display the updated product on the first navigation.
The onGet you are showing in the screenshot is nested inside edit-product, but would not affect the caching for /shop, right? Just realized that your screeenshot shows q-data coming from cache so that definitely seems like your problem.