I’m using the plugin “Simple Unsplash (only random)” plugin to automatically get a random Unsplash image on page load. However, I want the user to press a “Get new image” button to get a new image if he’s not happy with the current one.
Is there a way to refresh a plugin, or update an obtained image?
Are you using the “API Call” of the plugin as data for an image?
Looks like it has a clear_cache
parameter.
Try setting it up dynamically (for example create a custom text state and use it as value for this parameter). I guess that if you change the value in a workflow the request will trigger again.
Edit: The clear_cache
parameter needs to be different every time you want to fetch a new image, otherwise bubble will use the previous request instead of making a new one.
See how the OP solved it here: How to get a new random Unsplash image - #7 by andrew36
1 Like
Thanks, that half worked! It only works once. The second time I press the button nothing changes. For some reason, it doesn’t matter what text the custom state contains, “yes” or “dfsfgdj” clears the cache and reloads the image. Any ideas?
Hey! I’ve used this plugin before. So for example you have a card with random image from plug-in. To generate new one. On press of a button => make changes to “thing”, image = api call generate new image(from a plug-in)
Because if you just put api call on conditional or “when image is empty” it will generate new image every time page is load
Hi, thanks but these don’t work. I also save the image source to the database, so the image doesn’t get generated on page load.
Solved! I noticed that any value in the clear cache field updated the image, so I had to create a new value every time the ‘new image’ button was pressed. I did this by incrementing a number in a custom state and putting that in the clear cache field 
Sorry, it wasn’t clear (to me at least) that’s what you meant. I’ll credit you.
Thanks. I modified the answer to make it more clear and I pointed to your implementation of the solution. 