Skip to content
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

"Bound" methods inside the node_modules #821

Closed
theKashey opened this issue Jan 25, 2018 · 2 comments
Closed

"Bound" methods inside the node_modules #821

theKashey opened this issue Jan 25, 2018 · 2 comments

Comments

@theKashey
Copy link
Collaborator

theKashey commented Jan 25, 2018

When code got replaced we are registering new classes, and merging the new code with the old one.
This includes hacking into class instances, to replace methods on the fly.
There is 4 types of methods:

  1. methods - variables. We just copy new values
  2. methods - arrow functions. We will use eval, injected by babel, to update them.
  3. bounds methods. Ie this.fn = this.fn.bind(this).
  4. anything else.

1 - ok, 2 - ok, as long babel will handle it, 4 - ok, as long we dont care.
But 3 - is a problem.

screen shot 2018-01-25 at 11 14 14 pm

Basically, we could not detect the change, it is always "native code", and always trying to update these methods. But the current logic is still bound to eval. Which is not a thing for code from node_modules.

As result - react-redux will emit a warning on each update.

Possible solutions:

  • hack class prototype and override .bind of every method, to get control over it.
  • do nothing, as long code from node_modules could not change, and there is no need to inject the new version of a method.

Proposed solution:

  • as long client code is always covered by babel, and non-client code is always not - just remove the warning. Don't do anything else.
@gregberge
Copy link
Collaborator

I am OK with your solution. No more hack!

@theKashey
Copy link
Collaborator Author

Should be mitigated by cold components #991

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

No branches or pull requests

2 participants