Closed brandonwatson closed 1 month ago
Hey @brandonwatson sorry you're experiencing this issue. Thanks for providing all this information. I was able to reproduce this and confirmed that removing the processFile
prop fixes the issue. We'll start working on a fix and will provide updates here.
I noticed when I refresh the page it works as expected, it's only after one file has already been uploaded that it becomes an issue. Are you seeing that as well?
FYI @tytremblay @OperationalFallacy
Can you explain that second paragraph a little better? I guess I haven't been cold loading the page after a recompile, restarting NPM run Dev, I don't think. But I don't know the refreshing at anything to do with it. But I can certainly check that if you can be a bit more explicit with your repro steps.
From: Emma Sauerborn @.> Sent: Friday, September 20, 2024 9:12:34 AM To: aws-amplify/amplify-ui @.> Cc: Brandon Watson @.>; Mention @.> Subject: Re: [aws-amplify/amplify-ui] FileUploader is triggering 2 uploads to s3 when using ProcessFile prop (Issue #5817)
Hey @brandonwatsonhttps://github.com/brandonwatson sorry you're experiencing this issue. Thanks for providing all this information. I was able to reproduce this and confirmed that removing the processFile prop fixes the issue. We'll start working on a fix and will provide updates here.
I noticed when I refresh the page it works as expected, it's only after one file has already been uploaded that it becomes an issue. Are you seeing that as well?
FYI @tytremblayhttps://github.com/tytremblay @OperationalFallacyhttps://github.com/OperationalFallacy
— Reply to this email directly, view it on GitHubhttps://github.com/aws-amplify/amplify-ui/issues/5817#issuecomment-2363960853, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AABV5JJDHLHLHWMHQ4INRFTZXQ3ODAVCNFSM6AAAAABORAUZO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRTHE3DAOBVGM. You are receiving this because you were mentioned.Message ID: @.***>
@brandonwatson Yeah I just meant hitting the refresh button on the web browser and then uploading a file.
@tytremblay thanks for the heads up. When I was director of developer platform for Windows Phone I was a pretty public figure and had no problem publishing my phone number. Who's one of my core team principles about being universal accessible to our customers. I'm sure my Colorado number is out there now with everything I do, but I went ahead and removed it all the same.
@brandonwatson Yeah I just meant hitting the refresh button on the web browser and then uploading a file.
I tried your repro and hit refresh. This did not change anything in terms of outcome. I still had two file uploads.
Some more project info, in case this is helpful - and please ask for any additional data.
First and foremost, I am a self-taught dev, and this project was being used to teach me TypeScript, so just keep that in mind.
I am a former L8 Product Manager with AMZN
I am using SSR wherever possible and pushing "use client" as low in my render tree as possible
In this instance, I have a top level page that is a protected route.
This page.tsx renders inside of it a client component (PropertyEditForm.tsx) which is a wrapper for the interactive content on the page. page.tsx passes returned server called database content to PropertyEditForm.
The PropertyEditForm uses the passed in data to fill items on the page, one of which is a map function that calls another client component (PropertyRoom.tsx)
PropertyRoom.tsx contains the component ImageUploadModal, which is the code I supplied in the original report.
ImageUploadModal is what is causing the double file upload.
Inside PropertyRoom I am also making a db call from a useEffect to get data which was not passed down from the original query. This is not a long term solution, and I need to update my selectionSet from the original DB call to make sure that the useEffect gathered data arrives with the props from page.tsx. I was still very much coming to grips with where server and client boundaries were, and how to go about getting data, subscribing to data, etc, and this was where I ended up. Looking at it now, I know I need to fix what data is coming down in the props and not use useEffect to gather additional data.
UPDATE
@brandonwatson Was able to repro the issue, we are working on a fix now
This has been fixed in the latest version @aws-amplify/ui-react-storage@3.3.4
https://www.npmjs.com/package/@aws-amplify/ui-react-storage/v/3.3.4
I have removed 3.3.3, and ran npm install @aws-amplify/ui-react-storage@latest which updated to 3.3.4.
For anyone else who had this issue and was updating, this is not sufficient.
I had to take the extra step of perm deleting node_module directory and running npm install for this change to take effect.
3.3.4 appears to no longer double upload files.
Before creating a new issue, please confirm:
On which framework/platform are you having an issue?
React
Which UI component?
Storage
How is your app built?
Next.js
What browsers are you seeing the problem on?
Microsoft Edge
Which region are you seeing the problem in?
us-west-1
Please describe your bug.
Usiing FileUploader from '@aws-amplify/ui-react-storage' and utilizing the ProcessFile prop is causing a double upload. I was on: "@aws-amplify/ui-react-storage": "^3.3.1",
and updating to: "@aws-amplify/ui-react-storage": "^3.3.3",
Did not solve the problem.
I had found this old bug: https://github.com/aws-amplify/amplify-ui/issues/5467, and it appeared that it was closed and fixed back in 3.1.6 but I can replicate this problem.
What's the expected behaviour?
One file upload. I have confirmed that the removal of the ProcessFile prop reverts back to the behavior of one file being uploaded.
I am simply trying to change the file name to something that is UUIDv4 based. Nothing crazy. I can confirm that two files are uploaded to S3. I can confirm that the processFile function is being called twice.
Help us reproduce the bug!
Code Snippet
Console log output
Additional information and screenshots
No response