Back

image caching issue

  • 0
  • Web
  • Storage
  • Cloud
abu_sufyan
10 Nov, 2023, 17:57

hi, could anybody tell me how to solve the issue of caching the file upload , when i delete the file(image) and create a new file with same id of previous deleted image I should get the newly added image in file preview but as when i create the new file i got the preview of previously deleted image:

Reproduction steps

TypeScript
Upload an image to a bucket with a custom id (say test)
Delete that image from the bucket and add a different image but with the same id (test),

👍 Expected behavior:

Should show a different image now

👎 Actual Behavior:

Shows the old image

please solve this issue for me. thanks

this issue also arises here: https://github.com/appwrite/appwrite/issues/5529

TL;DR
User is experiencing an issue with image caching when updating user profile pictures. They are reusing the same ID for the profile picture and the image is not updating. The user wants to know if there is a way to solve this issue and prevent browser caching. The user is using React JS as the frontend. There is a link to a GitHub issue with a similar problem. Solution: The issue is caused by browser caching, and clearing the cache or doing a hard refresh may solve the problem. However, there is no permanent solution to prevent browser caching. Reusing IDs is not recommended.
abu_sufyan
10 Nov, 2023, 18:00

image caching issue

Kenny
10 Nov, 2023, 18:02

Wouldn’t this be your browser caching it? I’m not sure if there is a way for you to change the browsers image caching settings on anything but your own device.

abu_sufyan
10 Nov, 2023, 18:05

Not sure of where this issue arises from. But looking for solution If any alternative solution any body have Please recommend me I got stuck in my project.

Kenny
10 Nov, 2023, 18:06

What are you trying to accomplish? Why are you wanting to reuse IDs?

abu_sufyan
10 Nov, 2023, 18:09

I want to set the user profile picture id using the same user $id But the issue arises when I try to update the profile picture

Drake
10 Nov, 2023, 18:50

does doing a hard refresh/clearing your cache make the new image show?

abu_sufyan
10 Nov, 2023, 19:03

only browser hard cache clearing gets the job done. do you have any permanent solution so that the code doesn't allow the browser to cache the data? I am using React JS as the frontend.

Drake
10 Nov, 2023, 19:27

I highly recommend, not re-using the IDs. The caching is done by your browser and it's outside the control of Appwrite

abu_sufyan
11 Nov, 2023, 05:01

But tell me at what basis I can retrieve the profile pic of the user? Any possible way you can tell me?

Drake
11 Nov, 2023, 05:03

What do you mean?

abu_sufyan
11 Nov, 2023, 05:06

Actually I retrieve the user profile image by the user $id, it seems to me the possible way. That's why I am using the same id even after the update of the profile image. But here is a cache problem. So any other way to do so?

Drake
11 Nov, 2023, 05:08

I already said don't recreate with the same ID

abu_sufyan
11 Nov, 2023, 05:08

Okay

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more