feat: Add cache-busting to avatar image URLs and implement show more/less functionality for certifications.
This commit is contained in:
@@ -73,7 +73,14 @@ function ProfileCard({ profile }: ProfileCardProps) {
|
||||
if (profile.avatar && !profile.avatar.startsWith('http') && !profile.avatar.startsWith('/')) {
|
||||
try {
|
||||
const presignedUrl = await uploadService.getPresignedDownloadUrl(profile.avatar);
|
||||
setAvatarUrl(presignedUrl);
|
||||
// Add cache-busting parameter to force browser to fetch fresh image
|
||||
// This prevents showing old cached image when avatar is updated
|
||||
const profileWithTimestamp = profile as unknown as { updatedAt?: string };
|
||||
const cacheBuster = profileWithTimestamp.updatedAt
|
||||
? new Date(profileWithTimestamp.updatedAt).getTime()
|
||||
: Date.now();
|
||||
const urlWithCacheBuster = `${presignedUrl}&_t=${cacheBuster}`;
|
||||
setAvatarUrl(urlWithCacheBuster);
|
||||
} catch (error) {
|
||||
console.error('Failed to get avatar URL:', error);
|
||||
}
|
||||
@@ -82,7 +89,7 @@ function ProfileCard({ profile }: ProfileCardProps) {
|
||||
}
|
||||
};
|
||||
fetchAvatarUrl();
|
||||
}, [profile.avatar]);
|
||||
}, [profile.avatar, profile]);
|
||||
|
||||
const getProfileImageUrl = () => {
|
||||
if (avatarUrl) return avatarUrl;
|
||||
|
||||
Reference in New Issue
Block a user