Related to T2593. Removed transformFile prop and related function from Dragger component in CreateTokenForm. According to the error, the component should simply use the beforeUpload prop directly. This related PR (https://github.com/ant-design/ant-design/pull/28365), describes the following: "The original beforeUpload already supports the transformFile capability and removes related documents. This also fixes an issue where the preview function would not use transformFile transformed files."
Details
- Reviewers
bytesofman - Group Reviewers
Restricted Project - Commits
- rABCbc8729c3ab4a: [Cashtab] fix antd error in console when user clicks Create eToken
cd web/cashtab && npm start
navigate to create eToken screen
observe that the error does not fire
drag an image file into the Dragger component
The image should upload.
Drag an unsupported filetype over the Dragger component
A modal should appear instructing user to upload only jpg & png files.
Diff Detail
- Repository
- rABC Bitcoin ABC
- Branch
- patch-error-on-create-etoken-click
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 20206 Build 40097: Build Diff cashtab-tests Build 40096: arc lint + arc unit
Event Timeline
This "works" in that it does appear to resolve the previous error and token creation with icon still functions.
However, it generates a new error, and it's hard to say whether or not the new error is preferable to the old one. It certainly is not as extensively tested.
We get this red error in the filename:
Then we also get a persistent POST http://localhost:3000/ 404 (Not Found) in the dev console when an icon is selected.
Need some more research on this issue. See if you can find other users with this same problem, there may be an updated way to use this component.
Responding to review feedback. Found a solution to the new error on SO: https://stackoverflow.com/questions/60414352/next-js-ant-design-dragger-file-upload-fails-on-deployed-instance. Further info about the custom request can be found here: https://github.com/react-component/upload#customrequest. According to the user who posted the solution, "by default, the ANTD upload component makes a POST request to upload the file. So, to avoid this, add a customRequest props on Upload as below."