Skip to content

Commit

Permalink
Fix image modal
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jul 9, 2024
1 parent 972b7e3 commit 135f20a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/extensions/image/ImageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,12 @@ function ImageUpload({ initialImage, setUploadedImageLink }: ImageUploadProps) {
<ImageLoader
clearImage={() => setImageUrl('')}
src={imageUrl}
onLoad={() =>
setUploadedImageLink((prev) => ({ ...prev, loadedLink: imageUrl }))
}
onLoad={() => {
// To prevent this called first before the useEffect, which causes image rendered, but the link is null
setTimeout(() => {
setUploadedImageLink((prev) => ({ ...prev, loadedLink: imageUrl }))
})
}}
/>
)
}
Expand Down

0 comments on commit 135f20a

Please sign in to comment.