-
Notifications
You must be signed in to change notification settings - Fork 143
feat: Add shimmer placeholder during AI transformation polling #618
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
base: main
Are you sure you want to change the base?
feat: Add shimmer placeholder during AI transformation polling #618
Conversation
…vent broken image icons
|
Someone is attempting to deploy a commit to the Cloudinary DevX Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi, @devpatocld. Please take a look at this. |
|
@Vaibhav91one PR under review. Please be patient! Thank you |
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.
Hi @Vaibhav91one! Thank you so much for this contribution. Unfortunately I don't think we can accept it in its current state.
A solution must be unopinionated about what the visual placeholder state is - doing very little by default and adding easy styling hooks for overriding. The shimmering here, with hardcoded colors, timing, etc. looks great in some contexts but certianly will not suit every context, and the un-turn-off-able motion likely violates WCAG requirements. We can't do all of that by default, and this PR doesn't provide users a way to supply their own placeholder styles. I would love it if this simply added a class or data- attribute, and perhaps a default style that set a transparent gray background, which was easy to override.
The addition of a container element is also problematic. Users may depend on the specific DOM structure <CldImage> returns, and this change would break those assumptions. If possible, instead of hiding the image, and showing its container, perhaps we could replace the src/srcset with a transparent gif, until the polling is complete.
I do think that the new useState added here (isPolling) is going to be the foundation of a solution here.
Does that feedback make sense? I've tried to outline what is not acceptable here, but am not entirely sure my suggested ways forward would work, and know they are incomplete. It's more than possible this will take a few tries and more discussion to get right. Do you want to take another swing at this?
|
Yes, Absolutely @eportis-cloudinary . Thank you for the feedback. After reviewing the feedback, I wanted to discuss two approaches and would like your opinion on it.
This accepts optional children function that receives
This approach accepts optional pollingFallback prop with React component. Automatically shows/hides during polling. but there is no access to polling state for custom logic. |
|
Hi @eportis-cloudinary @devpatocld any update on the above? |
Problem
When AI transformations return
423 (Locked)status during processing, broken image icons appear during polling.PR for issue #514
Solution
Added a shimmer placeholder that displays during 423 polling:
Changes
src/components/CldImage/CldImage.tsxTesting
Hard refresh to see shimmer during AI processing.