-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
TypeError: Cannot read property 'parts/Globals.js' of undefined #10588
Comments
Hi @ivanakimov Thanks for reporting the issue. As you found out, this is caused by mismatching versions (e.g. Highcharts v7.0 and modules for v7.1) - for example one file is cached, other was updated properly. Nothing else comes to my mind. Could you make sure that installed version of Highcharts is v7.1.1? import Highcharts from 'highcharts/highstock';
import HighchartsExporting from 'highcharts/modules/exporting';
import HighchartsReact from 'highcharts-react-official';
console.log(Highcharts.version);
HighchartsExporting(Highcharts); If the version is the same, then could you perhaps setup a git repo with simplified demo of the issue? Anything that helps us debug the issue is more than welcome. |
Hi @pawelfus, Thanks for the quick response. For some reason I get |
Thanks for the demo! It's broken for me too. @jon-a-nygaard - could you take a look? |
@pawelfus @jon-a-nygaard I very much appreciate the insane amount of free open-source work going into this project, but wanted to see if you guys had any rough estimate for how long patching something like this might take? 😅 |
Hi, for me it seems to be something wrong with the documentation for highcharts-react. Highcharts waits until it has access to a window and document before it constructs itself, and it can not be extended with modules until this is done as it does not exist. A suitable place for this may be in the @pawelfus Do you know if this worked properly before? I can not find a demo of this. @ivanakimov Unfortunately I can not give a good estimate yet as I am still unsure what actions we need to resolve the issue, but I hope we can have this clear soon. |
@jon-a-nygaard I see, got it. Please let me know if you'd like me to do/test anything else once you guys figure out a bit more. |
@ivanakimov In short: the code runs twice and we don't want it to initialize the modules on server side, so add a check and all should be fine. This code for import React, { Component } from 'react';
import Highcharts from 'highcharts/highstock';
import HighchartsExporting from 'highcharts/modules/exporting';
import HighchartsReact from 'highcharts-react-official';
if (typeof Highcharts === 'object') {
HighchartsExporting(Highcharts)
}
export default class Chart extends Component {
render() {
return (
<HighchartsReact highcharts={Highcharts} options={{}} />
);
}
} I would like to close the issue as a duplicate and resolved, but I'll wait first for your replies. |
Thanks @KacperMadej! For me it makes sense to close it as a duplicate unless there is more to add to this issue. |
@KacperMadej confirmed -- thank you all for taking a look! |
@ppotaczek can you update docs in README ? |
Sure, I think that is a good idea. Maybe it is worth to add that information to the other wrapper docs as well? @Denyllon, @KacperMadej |
I've just added a reference to this thread inside of related What do you think @KacperMadej? |
All people responsible for the wrappers know the problem now, so we'll be able to answer similar cases fast through support channels. The problem was never before reported successfully in context of any other environment that React, so adding this to docs or even FAQ for Vue or Angular wrappers might be an overkill. I'll ensure that the info will added to Knowledge Base on Freshdesk. In short: I agree with Daniel. KB in Freshdesk case will be created soon (after or even before the official launch of Highcharts Freshdesk). |
Hi @KacperMadej (and all), I think I just came up with a much simpler solution that both you and your users may like more. It's captured in PR #137. So, rather than having to be burdened with updating the docs and FAQs, the docs could actually be slimmed down with a ".use" method defined on the wrapper, and let the wrapper register any supported feature with options. The ".use" method captured the bulk of the solutions described in this thread so that users of the HighchartsVue wrapper can simply do:
In the PR, I also updated the README which was able to be reduced because of this. Going forward, it may be more adaptable if the wrapper also exposed a "supportedFeatures" to perhaps be used by an IDE's intellisense. I'll happy to hear your feedback. |
Thank you for the PR. Highcharts Vue wrapper developers and maintainers will be taking care of the PR and should provide more info there when available. Updating docs and FAQs are not a problem. It is more important for us that all developers and maintainers of the wrappers know the issue because technical support very often must provide answers even for the questions already answered in docs and FAQs. BTW Next.js removed the relevant FAQ entry about the problem, so maybe it was resolved. |
Hi! I appreciate your response and perspective! For me, I was using the Nuxt framework (which is like Next.js, but for Vue), and I was encountering this issue too. I realized that while the "highcharts is object" check worked, it was even easier to configure Nuxt to only have the highcharts run client-side (example here). (In Nuxt, the framework respects the naming convention of plugin files ending in ".client.js" and ".server.js"; so simply naming my plugin "globals.client.js" was a simple fix for me). |
Thanks to @KacperMadej for the reply, and it resolve my issue too, but I think it's more important update the React/Angular wrapper documentation with this workaround for this known problem since it's been from 2019 it shows up and i don't find anything about it in the official page of installation. |
Hi @fiorins, the info has already been added to our React/Angular wrapper docs, see:
Am I missing something? |
Expected behaviour
Highcharts loads.
Actual behaviour
Highcharts doesn't load.
Live demo with steps to reproduce
It's hard to give a live demo as this is happening in our Next.js repo.
This is the code we use:
Pretty much exactly what the
README
says to do (with the addition ofhighcharts-react-official
). The error we get is:Product version
I also noticed this similar issue, but both Highcharts and Exporting module is coming from the same repo, so not sure if this affects us: #10465
Affected browser(s)
Error shows up in the server console log & browser, since Next.js is a universal app.
The text was updated successfully, but these errors were encountered: