From 125e0090262fcf3cdcec6c676cdfcf910a269b8a Mon Sep 17 00:00:00 2001 From: JIIOryo Date: Tue, 2 Apr 2024 16:39:30 +0900 Subject: [PATCH] fix(app): generate fileReader id randomly --- .changeset/rich-beers-worry.md | 5 +++++ packages/app/src/components/fileReader/index.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/rich-beers-worry.md diff --git a/.changeset/rich-beers-worry.md b/.changeset/rich-beers-worry.md new file mode 100644 index 000000000..a8121b1a4 --- /dev/null +++ b/.changeset/rich-beers-worry.md @@ -0,0 +1,5 @@ +--- +"@viron/app": patch +--- + +Fixed to randomly generate fileReader id to avoid duplication. diff --git a/packages/app/src/components/fileReader/index.tsx b/packages/app/src/components/fileReader/index.tsx index b1015fa00..adc8f9892 100644 --- a/packages/app/src/components/fileReader/index.tsx +++ b/packages/app/src/components/fileReader/index.tsx @@ -6,7 +6,7 @@ export type Props = { } & Pick, 'accept'>; const _FileReader: React.FC = ({ accept, onChange }) => { const id = useMemo(() => { - return `fileReader-${Date.now()}`; + return `fileReader-${Math.random()}`; }, []); const [file, setFile] = useState(null);