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

Linking charts to kibana creates error #466

Closed
nickofthyme opened this issue Dec 2, 2019 · 3 comments
Closed

Linking charts to kibana creates error #466

nickofthyme opened this issue Dec 2, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@nickofthyme
Copy link
Collaborator

nickofthyme commented Dec 2, 2019

Describe the bug
Linking charts creates an invariant error because we are using hooks with a different version of react.

We need to switch react and react-dom to peerDependencies and devDependencies. Preferably the same as in kibana to avoid unknown errors.

To Reproduce
Steps to reproduce the behavior:
run yarn link in charts and link in kibana. Notice the error in the console when viewing any elastic-chart.

Expected behavior
No errors

Versions:

  • OS: any
  • Browser: any
  • Elastic Charts: master

Errors in browser console

Uncaught Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
The above error occurred in the <Provider> component:
    in Provider
    in Chart (created by XYChart)
    in XYChart (created by XYChartReportable)
    in div (created by VisualizationContainer)
    in VisualizationContainer (created by XYChartReportable)
    in XYChartReportable
    in PseudoLocaleWrapper (created by I18nProvider)
    in IntlProvider (created by I18nProvider)
    in I18nProvider
@nickofthyme nickofthyme added the bug Something isn't working label Dec 2, 2019
@nickofthyme
Copy link
Collaborator Author

related to #378

@markov00
Copy link
Member

hey @nickofthyme not that we have the react and react-dom as peer dependency, can you reproduce this issue?

@nickofthyme
Copy link
Collaborator Author

nickofthyme commented Feb 27, 2020

Actually I think I still tried it with that and it was still an issue because EC will still use the EC/node_modules/react not KIBANA/node_modules/react.

The solution, per this SO article, was to use yarn link to link EC to kiabna and then run npm link <path_to_kibana>/node_modules/react in EC. Then it worked.

But now with the shared deps package it doesn't work at all so I just remove EC from the shared deps if I need to link it. Seems very complicated for such a simple task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants