bigcapitalhq / bigcapital

💵 Bigcapital is financial accounting with intelligent reporting for faster decision-making, an open-source alternative to Quickbooks, Xero, etc.
https://bigcapital.app
GNU Affero General Public License v3.0
2.6k stars 236 forks source link

Uploading attachments are not working #728

Open StefanHolst opened 1 month ago

StefanHolst commented 1 month ago

Affected Versions

26088a71ee82068b7a45ba6ec4d81307a3dfd541 and v0.20.6

Description of Bug

Uploading attachments to bills or expences fails when checking if the file was succesfully uploaded.

image

image

It looks like the commit https://github.com/bigcapitalhq/bigcapital/commit/37fd4a1fdb033a08aae6bf03e73879bcee4df515 to support feat: Uploading company logo broke support for uploading other attachments: useUploadAttachments and useMutation

https://github.com/bigcapitalhq/bigcapital/blob/v0.20.6/packages/webapp/src/containers/Attachments/UploadAttachmentsPopoverContent.tsx#L76

Stacktrace

UploadAttachmentsPopoverContent.tsx:111 TypeError: Cannot read properties of undefined (reading 'data')
    at Object.onSuccess (UploadAttachmentsPopoverContent.tsx:80:21)
    at mutation.js:92:71
(anonymous) @ mutation.js:106
Promise.catch
t.execute @ mutation.js:102
n.mutate @ mutationObserver.js:83
onChange @ UploadAttachmentsPopoverContent.tsx:111
onDrop @ ImportDropzoneFile.tsx:46
(anonymous) @ index.mjs:470
(anonymous) @ index.mjs:513
Promise.then
(anonymous) @ index.mjs:512
onClick @ ImportDropzoneFile.tsx:77
ke @ react-dom.production.min.js:54
je @ react-dom.production.min.js:54
(anonymous) @ react-dom.production.min.js:55
Dr @ react-dom.production.min.js:105
Hr @ react-dom.production.min.js:106
(anonymous) @ react-dom.production.min.js:117
cc @ react-dom.production.min.js:273
ze @ react-dom.production.min.js:52
Gr @ react-dom.production.min.js:109
$t @ react-dom.production.min.js:74
Wt @ react-dom.production.min.js:73
Show 17 more frames
Show lessUnderstand this errorAI
UploadAttachmentsPopoverContent.tsx:80 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data')
    at Object.onSuccess (UploadAttachmentsPopoverContent.tsx:80:21)
    at mutation.js:92:71
linear[bot] commented 1 month ago

BIG-266 Uploading attachments are not working