TypeError: Cannot read property '0' of undefined
See original GitHub issueHi, I’ve been working on a whiteboard project and use perfect-arrow to draw connections. However, although 99% of the time the arrows render perfectly, there are sometimes the app crashed and gave me this error message. Through the debugging process I’m pretty sure the pos and rect information are successfully passed into the getBoxToBoxArrow function. Do you have any idea what might cause this problem? Thanks!
getBoxToBoxArrow
src/lib/getBoxToBoxArrow.ts:254
251 | ph1,
252 | padEnd
253 | )
> 254 | } else {
255 | ^ // Calculate an angle based on distance, overlap and intermediacy 256 | const distOffset1 = modulate(distEffect, [0.75, 1], [0, 1], true) 257 |
src/components/WhiteBoard/SpaceView.js:562
559 | const end = whiteBoardData.cardInstances.find(
560 | cardInstance => cardInstance.cardInstanceId === connection.toCardInstanceId
561 | );
> 562 | const arrowData = getBoxToBoxArrow(
563 | begin.pos.x,
564 | begin.pos.y,
565 | begin.rect.width,
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How To Fix Cannot read Property '0' of Undefined in JS
The Solution · Ensure you are using the correct variable · Perform a simple check on your variable before using it to make...
Read more >How to Prevent the Error: Cannot Read Property '0' of Undefined
If a property of an object is an array, it's possible to accidentally misspell the key or try to access the array through...
Read more >Fix: Cannot Read Property '0' of Undefined - Coding Beauty
The “cannot read property '0' of undefined” error occurs when you try to access the 0 index of an array-like variable, but the...
Read more >TypeError: Cannot read Property '0' of Undefined in JS
The "Cannot read property '0' of undefined" error occurs when trying to access the 0th index in a variable that stores an undefined...
Read more >Javascript Uncaught TypeError: Cannot read property '0' of ...
which means that, when you try to access d[ascii] , you are actually trying to access undefined[0] , hence the error.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s how to reproduce the bug:
@steveruizok It seems like now this new value will cause the app crash. Can you fix it?