🐛 Fix new image upload refresh when URL is the same
We now add a `v` query param containing the timestamp to make sure each newly created file URL is unique
This commit is contained in:
@@ -31,7 +31,7 @@ export const UploadButton = ({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
if (urls.length && urls[0]) onFileUploaded(urls[0])
|
if (urls.length && urls[0]) onFileUploaded(urls[0] + '?v=' + Date.now())
|
||||||
setIsUploading(false)
|
setIsUploading(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,9 +43,7 @@ export const UploadButton = ({
|
|||||||
id="file-input"
|
id="file-input"
|
||||||
display="none"
|
display="none"
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
accept={
|
accept={fileType === 'image' ? '.jpg, .jpeg, .png, .gif' : '.mp3, .wav'}
|
||||||
fileType === 'image' ? '.jpg, .jpeg, .png, .svg, .gif' : '.mp3, .wav'
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
as="label"
|
as="label"
|
||||||
|
|||||||
@@ -26,10 +26,8 @@ export const MyAccountForm = () => {
|
|||||||
isSaving,
|
isSaving,
|
||||||
isOAuthProvider,
|
isOAuthProvider,
|
||||||
} = useUser()
|
} = useUser()
|
||||||
const [reloadParam, setReloadParam] = useState('')
|
|
||||||
|
|
||||||
const handleFileUploaded = async (url: string) => {
|
const handleFileUploaded = async (url: string) => {
|
||||||
setReloadParam(Date.now().toString())
|
|
||||||
updateUser({ image: url })
|
updateUser({ image: url })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +44,7 @@ export const MyAccountForm = () => {
|
|||||||
<HStack spacing={6}>
|
<HStack spacing={6}>
|
||||||
<Avatar
|
<Avatar
|
||||||
size="lg"
|
size="lg"
|
||||||
src={user?.image ? `${user.image}?${reloadParam}` : undefined}
|
src={user?.image ?? undefined}
|
||||||
name={user?.name ?? undefined}
|
name={user?.name ?? undefined}
|
||||||
/>
|
/>
|
||||||
<Stack>
|
<Stack>
|
||||||
|
|||||||
Reference in New Issue
Block a user