taye / interact.js

JavaScript drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE9+)
http://interactjs.io/
MIT License
12.38k stars 785 forks source link

TypeError: undefined is not an object (evaluating 't[e+"X"]') #284

Closed lookfirst closed 9 years ago

lookfirst commented 9 years ago

I see this error every once and a while in my code. The subject is a bit off cause my code is minified. =)

I've traced that down to this line of code in getXY:

https://github.com/taye/interact.js/blob/master/interact.js#L648

It appears that sometimes pointer is undefined.

Any chances of adding some undefined protection around that code?

Thanks.

taye commented 9 years ago

This should be fixed in v1.2.5. Which version are you using?

lookfirst commented 9 years ago

I am on master cause you hadn't done a release in a while. =)

Just saw another one in my rollbar logs overnight.

taye commented 9 years ago

Has it happened multiple times? Can you get a stack trace (even if it's minified)?

lookfirst commented 9 years ago

Sadly that is all I get from rollbar for this. Sorry! Wish I could help more.

On Sep 18, 2015, at 10:39 AM, Taye A notifications@github.com wrote:

Has it happened multiple times? Can you get a stack trace (even if it's minified)?

— Reply to this email directly or view it on GitHub.

lookfirst commented 9 years ago

Yes. It is happening a few times a day on a fairly heavy trafficked website.

On Sep 18, 2015, at 10:39 AM, Taye A notifications@github.com wrote:

Has it happened multiple times? Can you get a stack trace (even if it's minified)?

— Reply to this email directly or view it on GitHub.

taye commented 9 years ago

I've removed the code that splices idle interactions. That might help. I'm extremely reluctant to add undefined protection.

lookfirst commented 9 years ago
undefined is not an object (evaluating 'pointer[type + 'X']')
1 File bundle.js line 47721 col 19 in getXY
2 File bundle.js line 47732 col 12 in getPageXY
3 File bundle.js line 47693 col 14 in setEventXY
4 File bundle.js line 48279 col 24 in setEventXY
5 File bundle.js line 48572 col 24 in pointerMove
6 File bundle.js line 49656 col 30 in [anonymous]
lookfirst commented 9 years ago

@taye Your latest changes seem to have helped. =) I'm going to close this now. Thanks so much for your help.

ptchand commented 7 years ago

Observing the same issue "TypeError: undefined is not an object (evaluating 't[e+"X"]')". We are using v1.2.8 version. This issue is not been observed in development only observed in production. Any help is appreciated.

shashank100 commented 7 years ago

@taye Facing the same issue @ptchand did you find anything

shankhadeep commented 7 years ago

@taye I am also facing the same issue, please help us

ptchand commented 7 years ago

@taye Facing few other errors related to it

taye commented 7 years ago

Use `npm install interactjs@next" or download it from https://rawgit.com/taye/interact.js/unstable/dist/interact.min.js.

ptchand commented 7 years ago

We are using Webpack. Getting this following error during UglifyJs.

00:30:19 ERROR in js/qbo-help-ui.js from UglifyJs 00:30:19 SyntaxError: Unexpected token: operator (>) [./~/interactjs/src/utils/isWindow.js:1,0] 00:30:19 Child extract-text-webpack-plugin:

alpritt commented 7 years ago

I'm still getting this error in v1.2.9 in my production logs. Should this be fixed in 1.2.9 or only in the 1.3.0 alphas?

I've not been able to recreate this myself yet. But if you have any idea what could be causing it, I will try to do so.

undefined is not an object (evaluating 't[e+"X"]') is occurring in iOS 10.x on iPad an iPhone or various other devices are giving Cannot read property 'pageX' of undefined. Both are at line 650 in getXY(). The line is xy.x = pointer[type + 'X'];

Stacktrace:

TypeError: undefined is not an object (evaluating 't[e+"X"]')
  at getXY(~/interactjs/interact.js:650:15)
  at getPageXY(~/interactjs/interact.js:667:12)
  at setEventXY(~/interactjs/interact.js:611:8)
  at method(~/interactjs/interact.js:1784:21)
  at apply(~/interactjs/interact.js:3325:32)
  at d(raven.js:386:28)
taye commented 7 years ago

@alpritt I can't verify that it's fixed, but it might be worth using the newer version. I've written a quick migration guide to make this easier. If anything trips you up, I'd be happy to help.

alpritt commented 7 years ago

Thanks @taye. I had a brief try of the alpha 0 and it's causing the native browser drag to appear (this is on an <a> element) which I think is cancelling interact's drag behaviour. I worked around this problem before, but my tricks to stop it aren't working now for some reason. So I will come back to this when I have more time.

I also get this warning when running this through webpack (which I didn't get with 1.2.9):

WARNING in ./~/interactjs/dist/interact.js
Critical dependencies:
8:481-488 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
 @ ./~/interactjs/dist/interact.js 8:481-488

Not sure if that is me installing it incorrectly. I just did sudo npm install git+https://git@github.com/taye/interact.js#v1.3.0-alpha.0