react-cursor-position icon indicating copy to clipboard operation
react-cursor-position copied to clipboard

Unable to get property 'getCursorPosition' of undefined or null reference

Open simeonpashley opened this issue 5 years ago • 11 comments

When using v2.5.0, I see numerous entries in Sentry with the same error report. I haven't used previous versions so I don't know if this is a new issue.

Unable to get property 'getCursorPosition' of undefined or null reference

In the code excerpt below, it implies that this.core is null/undefined

            this.schedulActivation(this.props.hoverDelayInMs);
        }
    }, {
        key: 'onMouseMove',
        value: function onMouseMove(e) {
            this.setPositionState(this.core.getCursorPosition(e));
        }
    }, {
        key: 'onMouseLeave',
        value: function onMouseLeave() {
            this.clearActivationTimers();

All the issues seem to be IE11 / Edge.... https://sentry.io/share/issue/b315166598af4d818172fd34cf2508db/ https://sentry.io/share/issue/4e135f3320604ae88d31a56f503906d7/ https://sentry.io/share/issue/b2a9bcd3f7144fe5b0f15cd1b5a2f81f/

simeonpashley avatar Jul 23 '18 09:07 simeonpashley

Hi @simeonpashley - Thanks for reporting this issue. I released a possible fix in version 2.5.1-0. Please try it by installing [email protected]. In case you are interested, the branch with the changes is named issue24. Please let me know your findings. ~Ethan

ethanselzer avatar Jul 24 '18 07:07 ethanselzer

Thanks, I'll give that a try.

FYI I'm using a component react-image-magnify, which uses your component

simeonpashley avatar Jul 24 '18 08:07 simeonpashley

Thank you for trying version 2.5.1-0. I appreciate it.

I had a look at react-image-magnify. It seems like it specifies version 2.4.1 of react-cursor-position. I'm wondering if you know why you have [email protected]

ethanselzer avatar Jul 24 '18 17:07 ethanselzer

@simeonpashley - I am able to reproduce the issue you identified in Windows Edge. I think it is corrected in v3.0.0. Thanks again for bringing it to my attention. I appreciate it!

ethanselzer avatar Sep 02 '18 06:09 ethanselzer

Anyone experiencing the "Unable to get property 'getCursorPosition' of undefined or null reference" issue in MS Edge, and also want the v2.x API, you can try v2.5.3.

ethanselzer avatar Oct 04 '18 04:10 ethanselzer

@simeonpashley - Thanks again for opening this issue. I'm closing it as fixed in latest and v2.5.3. Please let me know if you don't think it has been corrected.

ethanselzer avatar Nov 10 '18 04:11 ethanselzer

@ethanselzer Hi, I got this error from Sentry with v3.0.3

ReactCursorPosition.js:164 Uncaught TypeError: Cannot read property 'getCursorPosition' of undefined
   at t.value (ReactCursorPosition.js:164)

kimsangw avatar Jan 11 '19 21:01 kimsangw

Hi @kimsangw - Thanks for the information. Do you know if Sentry can provide details about the browser/OS? Also is there a high rate of this error?

ethanselzer avatar Jan 12 '19 06:01 ethanselzer

@ethanselzer there isn't any details about the browser but the rate of error is low.

kimsangw avatar Jan 14 '19 15:01 kimsangw

@kimsangw - Thanks for following up. I will investigate.

ethanselzer avatar Jan 16 '19 07:01 ethanselzer

Hi @ethanselzer, sentry is sending at least one time per day this error. I was also thinking is was an IE-only bug, but the last report was for Chrome. Here is the details about the user:

Browser: Chrome 81.0.4044 browser.name: Chrome device: Mac device.family: Mac os: Mac OS X 10.11.6 os.name: Mac OS X url: https://teamstarter.co/

The code breaks here:

    });
    }
  }, {
    key: 'onClick',
    value: function onClick(e) {
      this.setPositionState(this.core.getCursorPosition(e)); <--- HERE
      this.mouseActivation.mouseClicked();
      this.onMouseDetected();
    }
  }, {
    key: 'onTouchDetected',

vincentdesmares avatar May 06 '20 09:05 vincentdesmares