I’ve created a smart action that uploads an image to an S3 bucket. Everything is correct but I can’t get an image in a summary view to refresh after upload. It is based on the example provided in the docs.
What am I missing?
router.post('/actions/upload-logo', permissionMiddlewareCreator.smartAction(), (req, res) => {
// Get the current company id
const partnerId = req.body.data.attributes.ids[0];
// Get the values of the input fields entered by the admin user.
const attrs = req.body.data.attributes.values;
const image = attrs['Logo Image'];
P.all([
uploadLogo(partnerId, image),
])
.then(() => {
// Once the upload is finished, send a success message to the admin user in the UI.
return res.send({ success: 'Logo has been uploaded.' });
});
});
The name of the file is the same and therefore the URL path is the same.
It’s being server from a CDN.
Could it be that the browser is not downloading the new image as the url is the same and it’s being cached? I’ve had this issue in the website and I’ve workaround this by adding a dummy query parameter with a timestamp to the image URL.
Yes, I’m pretty sure that’s the issue. That is actually the issue on all website, when not updating an url it does keep the image in cache so the solutions are to either change the url or like you said add a dummy query parameter to the url (Just the one return no need to update it in DB)