Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Getting a lot of Null is not an object in production #27

Closed
robin-anil opened this issue Jan 21, 2017 · 5 comments
Closed

Getting a lot of Null is not an object in production #27

robin-anil opened this issue Jan 21, 2017 · 5 comments
Labels

Comments

@robin-anil
Copy link

TypeError: null is not an object (evaluating 'n.textarea.dispatchEvent')
1
File "webpack:///./~/react-autosize-textarea/lib/TextareaAutosize.js" line 55 col 1 in a
return _this.textarea.dispatchEvent(event);

In Chrome 55 UI Webview , Mobile Safari UI Webview 10, Mobile iOS Webview 10.

All these are variants of the same iOS Safari 10 engine.

@robin-anil
Copy link
Author

Also seen are

TypeError: Cannot read property 'dispatchEvent' of null
1
File "webpack:///./~/react-autosize-textarea/lib/TextareaAutosize.js" line 55 col 1 in a
return _this.textarea.dispatchEvent(event);

This one only occurs in Chrome 55 on Windows

@FrancescoCioria
Copy link
Contributor

FrancescoCioria commented Jan 21, 2017

Hi @r-tock , I'm sorry but I'm having trouble reproducing it.

What I can see from you logs is that the component is trying to dispatch an event through the ref this.textarea which, in your case, is null, and this causes the error.

Which version of React are you using? I'm asking because this looks like an error due to using an older version of React like v0.13

@robin-anil
Copy link
Author

robin-anil commented Jan 22, 2017

we are on the latest react 15.4.2, these are caught by rollbar.js

@robin-anil
Copy link
Author

Is it possible that this is caused by some race condition? Maybe while the component is being unmounted.

@FrancescoCioria
Copy link
Contributor

FrancescoCioria commented Jan 22, 2017

Is it possible that this is caused by some race condition? Maybe while the component is being unmounted.

It's possible even if we're using it in production in several projects and it never happend to us 😕

Still, I noticed that this ugly setTimeout could be easily removed by using componentDidUpdate instead of componentWillReceiveProps to manually trigger un update!

I'm hoping that removing the async setTimeout will fix your problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants