Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Highchart more cannot be called multiple time without issues #7729
With a flag to prevent
Live demo with steps to reproduce
Sorry I dont know how to fiddle it, this is a bug only when using the npm version and asynchronous
Webpack take care of the async load with
The advantage of this in a big app is having a single point quite like a factory to load Highcharts as external chunk from anywhere in your code, at any time, without worring about is this the 1st load or not.
Having it as external resource is a part of the code splitting logic from webpack and other bundlers. Your app is lighter and your vendor resources can be cached by the browser. And the major point is that the module is only loaded when needed, when imported.
This is why, and the is the modern JS app actual world, my app do not know if Highcharts was already loaded or not (and also because separation of concern) and just ask for it. The factory ask webpack for it and return it. That is it. That should be it.
If everyone has to care and check if the core was already extended by the more then it might be inside the lib or documented to avoid code duplication or error.
You could create a custom Highcharts file with loaded all modules and then
App should care about not loading files if they are loaded already, so this should resolved the problem.
If you would like to propose an enhancement idea for a checker that will do nothing on an attempt of loading an already loaded module please open an idea on userVoice of vote for the already registered one if it already exists. The most popular ideas are getting implemented.
referenced this issue
Feb 9, 2018
Your link about userVoice is broken.
And again, the issue is not loading twice, the modules are loaded only once, but the call to augment HighCharts with HighChartsMore can be done multiple time because the app is stateless and does not know if the call was already made or not.
To avoid all users to write the ugly check I did have to wrote, the check should be moved inside HighChartMore itself.
added a commit
Feb 12, 2018
@JSteunou I agree with you it's a bug.
Rather than looking for whether
Are you aware of any issues that come from this, so we should add the tests to other module files to?
@TorsteinHonsi there is also an issue if you load the drilldown module multiple times. The chart still functions as expected but it throws an error if you want to drill down into a series. See replication here:
@pawelfus I'm unsure if I understood this issue thread correctly. I have seen that work around but as of my understanding in the issue #6086 of 2016 it was decided that Highcharts should not check if you extend your import of Highcharts multiple times with modules e.g.
As of my understanding in this recent thread it is seen as a bug and that you want to prevent the possibility of extending Highcharts multiple times and with those errors which occur. Did I misunderstand anything?