Re: [whatwg/fetch] Using multipart/form-data with multer occasionally causes React app to crash and refresh (#677)

@lavaxun Sorry, it was just a silly issue on my end. Using Create-React-App with hot reloading enabled - the app will refresh when any code changes are found in the front-end React portion, but also when there are new files added.

In Multer portion of my backend REST API, I set a config middleware that stores new uploaded files locally in `client/public` folder, which triggers hot-reloading of the app. Multipart/fetch request for image upload hits the API, and API stores the new image on the repo's file system, which is located in the clientside React portion, and triggers a reload of the code. 

The img upload is part of 3 chained fetch requests, and this happens in the second one, and code refreshes before 3rd can execute and complete, causing an error. Because of nature of the async code, it will behave differently, occasionally the image is uploaded and saved, but a reference to the file location is not saved on DB so it can dynamically be rendered as src file in react, because it was the third chain fetch req which must do this. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/677#issuecomment-435186230

Received on Thursday, 1 November 2018 21:03:19 UTC