olahol / react-social

Simple React components for social buttons (Facebook, Twitter and Pinterest) and social counts.
177 stars 60 forks source link

Problem with server rendering #19

Closed efernandesng closed 8 years ago

efernandesng commented 8 years ago

warning.js:45 Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the undefined component.

warning @ warning.js:45
getInternalInstanceReadyForUpdate @ ReactUpdateQueue.js:34
ReactUpdateQueue.enqueueSetState  @ ReactUpdateQueue.js:181
ReactComponent.setState @ ReactComponent.js:65
(anonymous function) @ react-social.js:143
(anonymous function) @ ?callback=jsonp_1463407624090_466&url=http%3A%2F%2F127.0.0.1%3A3000%2Fpagina%2Fcronologia-dos-acont…:1

react@0.14.8

olahol commented 8 years ago

In version 1.2.0 I've moved updating count to componentDidMount, see if this helps.

efernandesng commented 8 years ago

Thanks for update :)

Apparently the problem is fixed, but occurs another similar problem: when the component make jsonp request and is unmounted before it finish and we get another setState warning. A possible solution is cancel all pending requests in componentWillUnmount.