🐛 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:
Baptiste Arnaud
2022-11-21 14:10:44 +01:00
parent 2489318fa5
commit fbd33046a1
2 changed files with 3 additions and 7 deletions

View File

@@ -26,10 +26,8 @@ export const MyAccountForm = () => {
isSaving,
isOAuthProvider,
} = useUser()
const [reloadParam, setReloadParam] = useState('')
const handleFileUploaded = async (url: string) => {
setReloadParam(Date.now().toString())
updateUser({ image: url })
}
@@ -46,7 +44,7 @@ export const MyAccountForm = () => {
<HStack spacing={6}>
<Avatar
size="lg"
src={user?.image ? `${user.image}?${reloadParam}` : undefined}
src={user?.image ?? undefined}
name={user?.name ?? undefined}
/>
<Stack>