-
Notifications
You must be signed in to change notification settings - Fork 801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔥Not all methods could|should be updated #1001
Comments
Look like it is impossible to properly "hot" update class, and even heavy babel magic will not work. 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 |
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. |
Use the full URL to link to issue gaearon#1001 in the readme. I think the short form that was used (`gaearon#1001`) only works in comments and PR messages.
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.
The problem
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 #949 and now they always got updated.
This causes #995, #978, #969, #984
RHL have rights only to update "own" functions, but could not detect them.
Solution
bound
class methods. Ie those ones, which names exists on prototype.The text was updated successfully, but these errors were encountered: