The componentDidUpdate() lifecycle method was only needed to work around a TypeError: Cannot read property 'detach' of undefined being thrown when a dynamic sheet is added via HMR.
This PR removes componentDidUpdate() and does all its work in componentWillReceiveProps() instead, so it won’t be able to be merged until react-jss stops attempting to detach the nonexistent previous dynamic sheet.
I also removed the call to createState() and instead restore the state that was created in the constructor. One fewer private method being called and it fixes the actual problem more directly.
The
componentDidUpdate()
lifecycle method was only needed to work around aTypeError: Cannot read property 'detach' of undefined
being thrown when a dynamic sheet is added via HMR.This PR removes
componentDidUpdate()
and does all its work incomponentWillReceiveProps()
instead, so it won’t be able to be merged untilreact-jss
stops attempting to detach the nonexistent previous dynamic sheet.I also removed the call to
createState()
and instead restore the state that was created in the constructor. One fewer private method being called and it fixes the actual problem more directly.