-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🎉 Cloudflare images image updating #4252
Conversation
@@ -152,6 +160,33 @@ function UserSelect({ | |||
) | |||
} | |||
|
|||
// when updatedAt changes, the image will reload the src | |||
// but it looks like sometimes cloudflare doesn't update in time :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only works sometimes, so maybe it's not worth it and we just let authors know that it can take up to a minute for the image to update after refreshing the page. Not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it doesn't work reliably, I'd add the disclaimer to the page. I'm not sure if I understand the intended functionality. If we want to refresh the image every time the updatedAt
changes, I think we could pass it as a key
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating the key was the first thing I tried, but it wouldn't actually make a new request, and then when I tried forcing it to re-render, it would load the cached version, so this is the only way I found to make it work. (Though it also sometimes hits the CF cache 😫)
I think I'll just keep it as it currently is and see what the authors make of it. I'll probably have to explain in slack that sometimes the preview doesn't update and that they need to click on the image to see what the actual current image is. Seems.. fine 🤷
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 0 ✅ Edited: 2024-12-04 15:52:27 UTC |
adminSiteClient/ImagesIndexPage.tsx
Outdated
} | ||
}) | ||
.catch(() => { | ||
console.log("Something went wrong refreshing the image") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand this correctly, we are effectively discarding the error here instead of letting it bubble up, which would be more helpful for debugging.
@@ -152,6 +160,33 @@ function UserSelect({ | |||
) | |||
} | |||
|
|||
// when updatedAt changes, the image will reload the src | |||
// but it looks like sometimes cloudflare doesn't update in time :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it doesn't work reliably, I'd add the disclaimer to the page. I'm not sure if I understand the intended functionality. If we want to refresh the image every time the updatedAt
changes, I think we could pass it as a key
instead.
Changes:
/images
now)PostImageButton
andPutImageButton
+ utils