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

hotRenderWithHooks dose not provide context (?) #1274

Closed
Bnaya opened this issue Jun 27, 2019 · 4 comments
Closed

hotRenderWithHooks dose not provide context (?) #1274

Bnaya opened this issue Jun 27, 2019 · 4 comments

Comments

@Bnaya
Copy link
Contributor

Bnaya commented Jun 27, 2019

getting TypeError: Cannot read property 'muiFormControl' of undefined

stack.type points to FormLabel is part of MUI 1.x, that expects getting context,
But the function call supplies only props.

Screen Shot 2019-06-27 at 8 23 07

react-hot-loader@4.11.1

react-dom@npm:@hot-loader/react-dom@16.8.6

BTW without patching react-dom, it works.

@theKashey
Copy link
Collaborator

theKashey commented Jun 27, 2019

React 15 legacy :(
Patching react-dom activates configuration option ignoreSFCWhenInjected, so RHL stop wrapping FC with anything. And that anything was a Class component for FCs with a legacy context (cos it's not easy to track it, so we used Class-based wrapper to track context value).

How to fix

  1. setConfig({ignoreSFCWhenInjected: false}) - it will fix hot comparison render when react-dom is patched
  2. setConfig({disableHotRendererWhenInjected: true}); - to disable buggy hotReplacementRender, and be happy ever after.

@Bnaya Bnaya closed this as completed Jun 27, 2019
@theKashey
Copy link
Collaborator

v4.12 comes with disableHotRendererWhenInjected set to true by default.

@Bnaya
Copy link
Contributor Author

Bnaya commented Jun 30, 2019

Can you elaborate a bit what we "lose" when disableHotRendererWhenInjected: true?

@theKashey
Copy link
Collaborator

Nothing. Except some bugs like you faced, plus some problems with libraries with use React.readContext method directly.

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

No branches or pull requests

2 participants