Expose a way to check if a profileImage is the default image #1965
Replies: 5 comments
-
Hello @b0o! Thank you for reaching out! This is actually a valid request! We are looking into it, and we will let you know! :) |
Beta Was this translation helpful? Give feedback.
-
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
Beta Was this translation helpful? Give feedback.
-
I found this. Is it supported or correct? |
Beta Was this translation helpful? Give feedback.
-
Hello @statico, |
Beta Was this translation helpful? Give feedback.
-
Hello! We're tracking our feature requests now in feedback.clerk.com. If your suggestion is already in the list of proposed changes, please upvote. Otherwise, please create an entry. Thanks! Our feedback platform will be the source of truth for feature requests going forward and your input and votes will help us shape the roadmap. Thanks for using Clerk! 💙 |
Beta Was this translation helpful? Give feedback.
-
Package
@clerk/clerk-js
@clerk/clerk-react
Description
We're working on replicating the add/remove profile image component in our application. We've found that you can set the image to
null
to remove the current image, but if the current image is the default image, the Clerk API responds with a404
error. Here's a very simple example:Clicking the
Remove Profile Image
button will work if the user has an image set, but it will cause an error if the user has the default profile image.The user object has no obvious way of determining whether the profile image is the default or not, but I did find a utility function to do it in this repo: https://github.com/clerkinc/javascript/blob/ae9fc247aca5bf8211cc8e021706325a010ce9d3/packages/clerk-js/src/utils/image.ts#L14-L29
This function isn't exported for external use, but your internal UI components do use it for this functionality: https://github.com/clerkinc/javascript/blob/ae9fc247aca5bf8211cc8e021706325a010ce9d3/packages/clerk-js/src/ui/components/UserProfile/ProfilePage.tsx#L99-L103
For now, I've just copied the implementation of
isDefaultImage
into our codebase. It would be nice if this was improved, though, either by adding a property to theuser
object likehasDefaultProfileImage: boolean
, or by exposing theisDefaultImage
utility.Beta Was this translation helpful? Give feedback.
All reactions