Open tonai opened 1 month ago
After some testing I added the code part to disable the buttons while drawing but I still see this issue appearing in the log of my app. The problem is I don't really know how to reproduce it... Here is the stack trace I have:
TypeError: Cannot read property 'dataset' of undefined
at Yo._appendNode (/client.js:26:27830)
at Yo.eventEnd (/client.js:26:26597)
It is clearly happing in that file: https://github.com/antfu/drauu/blob/main/packages/core/src/drauu.ts#L256
So maybe we should not pretend that currentNode can't be null
(const el = this._currentNode!
on line 177) and avoid the error by adding a simple if (el)
?
Describe the bug
You can raise errors when triggering some action while drawing.
To reproduce: 1.go to https://drauu.netlify.app/
TypeError: Cannot read properties of undefined (reading 'dataset')
On android it does not seem possible to hit some button while drawing but it is possible on ios so you may also trigger some errors (for example click on the eraser tool while drawing).
We might let the lib user handle this with something like:
and use
isDrawing
to disable the buttons:disabled="isDrawing"
. This is the current workaround to avoid the issue, but this require extra work, especially with vanilla JS.Maybe it can be handled inside the lib, to avoid the problematic cases.
Reproduction
https://drauu.netlify.app/
System Info
Used Package Manager
npm
Validations
Contributions