diff --git a/components/Inputs/FileInput.tsx b/components/Inputs/FileInput.tsx index df2b154d5..1a634abb0 100644 --- a/components/Inputs/FileInput.tsx +++ b/components/Inputs/FileInput.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import Image from "next/image"; import plusIcon from "@/assets/images/ic_plus.png"; @@ -26,6 +26,14 @@ function FileInput({ name, label, onChange }: FileInputProps) { setPreview(""); }; + useEffect(() => { + return () => { + if (preview) { + URL.revokeObjectURL(preview); + } + }; + }, [preview]); + return (