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

Limiting RHL (Winter is coming) #991

Closed
theKashey opened this issue May 25, 2018 · 7 comments
Closed

Limiting RHL (Winter is coming) #991

theKashey opened this issue May 25, 2018 · 7 comments

Comments

@theKashey
Copy link
Collaborator

theKashey commented May 25, 2018

User request:

import { nothot } from "react-hot-loader";
import GraphiQL as GQL from "graphiql";

const GraphiQL = nothot(GQL);  // RHL will not apply proxies to this function
...

Doable, but we could improve it - for example not proxy any components from node_modules, as long they should be considered static. (see #304 (comment))

Way to reproduce:

  1. Extend babel plugin to node_modules.
  2. Now RHL knew components origin
  3. hothow to all components with origin in node_modules
This was referenced May 25, 2018
@theKashey theKashey changed the title Limiting RHL Limiting RHL (Winter is coming) May 25, 2018
@theKashey
Copy link
Collaborator Author

  • A new ❄️ API - just cold, in the opposite of hot.
  • hook inside reactHotLoader.register(babelPlugin) to cool components by file patterns.

@ljharb
Copy link

ljharb commented May 25, 2018

It wouldn’t be reasonable to ask components that need to not be hot, to add a dep on react-got-loader.

Any mechanism for this should be something that doesn’t require adding this dep.

@gregberge
Copy link
Collaborator

I love the idea!

@theKashey
Copy link
Collaborator Author

@ljharb - by default all your components could be changed and hot-reloaded, and all thirdparty could not be changed, and thus we probably shall disable RHL for them, to lower side effects (type comparison, for example).
As result cold API gives your ability to "cold" components you "know" and get reference, and "cold" anything else by file mask.

The only problem - it will not work out of the box, cos 99% babel setups excludes node_modules.

@ljharb
Copy link

ljharb commented May 25, 2018

@theKashey yes, that’s true. But if hot loader won’t choose to be safe out of the box, then it seems right to offer an output that minimally inconveniences third parties.

@theKashey
Copy link
Collaborator Author

I am just not activating this untested feature out of the box, yet. And that is ok, as long it does not change the default RHL behavior.

@theKashey
Copy link
Collaborator Author

fixed in v4.3.0

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

3 participants