chore(git): merge pull request #208 from 184-upload-add into staging
Some checks failed
Release to Staging / build_and_release (push) Has been cancelled

Reviewed-on: #208
Reviewed-by: eugene <eugene@nostrdev.com>
This commit is contained in:
enes 2024-09-19 11:29:44 +00:00
commit ff875cc9d7

View File

@ -301,7 +301,15 @@ export const CreatePage = () => {
const handleSelectFiles = (event: React.ChangeEvent<HTMLInputElement>) => { const handleSelectFiles = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.files) { if (event.target.files) {
setSelectedFiles(Array.from(event.target.files)) // Get the uploaded files
const files = Array.from(event.target.files)
// Remove duplicates based on the file.name
setSelectedFiles((p) =>
[...p, ...files].filter(
(file, i, array) => i === array.findIndex((t) => t.name === file.name)
)
)
} }
} }