Each component consist of 2 different pieces:
To update second ones RHL creates 2 components - old and new, then compares all descriptors.
Comparison ignores "objects", thus keeps state untouched, and updates functions and simple variables.
But that does mean "updates functions"?
It literally cast function _toString_ and then eval that code in the context of Class.
Casting function toString defines _what is it_, not _how it was created_.
Before, RHL did update, only if "text" got changes, but it was changed https://github.com/gaearon/react-hot-loader/issues/949 and now they always got updated.
This causes https://github.com/gaearon/react-hot-loader/issues/995, https://github.com/gaearon/react-hot-loader/issues/978, https://github.com/gaearon/react-hot-loader/issues/969, https://github.com/gaearon/react-hot-loader/issues/984
RHL have rights only to update "own" functions, but could not detect them.
bound class methods. Ie those ones, which names exists on prototype.Look like it is impossible to properly "hot" update class, and even heavy babel magic will not work.
We should not try to find a way to fix the problem, which does not exists.
The right way:
__Not the change current component, but adopt a new one__
This require a one line change in React-Fiber - https://github.com/facebook/react/blob/dd5fad29616f706f484938663e93aaadd2a5e594/packages/react-reconciler/src/ReactChildFiber.js#L375
The similar changes as (not yet) was made to Preact - https://github.com/developit/preact/pull/1120
fixed in v4.3.0
nice
To be more concrete - this issue is __NOT CLOSED__.
This issue addresses the problem when class methods __should not be updated__, or this action would break your code - as a result, some methods __will not be updated__, while and __could__, and __should__.
Today this leads to partial incompatibility with React-Redux v6.
Most helpful comment
fixed in v4.3.0