UploadWidget in combination with GalleryWidget
Hi,
i am fighting with this for hours without getting cloudinary to work as expected. I have something like an Airbnb page, where you can upload photos of your flat. I am using the Upload Widget for that (signed Uploads). Works ok. But on the same page where i have my upload widget, i also have the Gallery Widget. So after Uploading the images, i send a "update" request to the gallery widget to re-render, which basically means, that he should get all the images with a certain "tag" in it.
The problem is, that the Gallery Widget and its XHR request to get the images (https://res.cloudinary.com/xxxxxx/image/list/mytag.json) returns an outdated list of resources, meaning, the ones previous in the bucket and not the ones just uploaded. If i wait 20 seconds and refresh the screen, then everything will be displayed.
Of course thats very confusing for potential user because they expect the Gallery to be updated instantly when the upload widget finished work. So does the Gallery Widget requests some kind of CDN which takes some time to reflect the changes? The Media Gallery in the cloudinary web console is not the problem, there i can see all files right after uplading, but the JSON request doesnt reflect what i see in the web console.
cheers
marc
-
Hi Marc,
Thanks for reaching out.
The client-side list you mentioned has actually a 60s cache as mentioned in the notes here, so in your case, before requesting the Gallery Widget, you should be able to use the Upload API destroy method using the type list and the invalidate parameter set to true to actually delete the existing list and invalidate the cache on the CDN so when you request it after a new upload, you will get the updated version.
Hope that helps.
Best,
Loic
Post is closed for comments.
Comments
1 comment