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

Unmount issue with AxisTitle #24

Closed
luzannew opened this issue Sep 7, 2017 · 3 comments
Closed

Unmount issue with AxisTitle #24

luzannew opened this issue Sep 7, 2017 · 3 comments

Comments

@luzannew
Copy link
Contributor

luzannew commented Sep 7, 2017

Hi, another unmount issue :(

I only have a minified stacktrace, but the code relates to this commit: 78ceaab

This was working in the 1.3.3 release.

// AxisTitle.js
componentWillUnmount () {
    if (this.props.getAxis()) { // getAxis throws the error
      this.updateAxisTitle({
        text: null
      });
    }
  }
highstock.js:formatted:1 Uncaught TypeError: Array.prototype.find called on null or undefined
    at find (native)
    at a.find (http://localhost:8080/bundle.js:43982:452)
    at a.Chart.get (http://localhost:8080/bundle.js:44208:343)
    at Object.v [as getAxis] (http://localhost:8080/bundle.js:70719:6862)
    at t.value (http://localhost:8080/bundle.js:70719:26192)
    at http://localhost:8080/bundle.js:63416:25
    at measureLifeCyclePerf (http://localhost:8080/bundle.js:63083:12)
    at ReactCompositeComponentWrapper.unmountComponent (http://localhost:8080/bundle.js:63415:11)
    at Object.unmountComponent (http://localhost:8080/bundle.js:5469:22)
    at ReactCompositeComponentWrapper.unmountComponent (http://localhost:8080/bundle.js:63425:23)

And also this one:

// Series.js
componentWillUnmount () {
    if (this.props.getSeries()) { // getSeries will throw the error below
      this.props.remove(); // Series may have already been removed, i.e. when Axis unmounted
    }
  }
Uncaught TypeError: Array.prototype.find called on null or undefined
    at find (native)
    at a.find (http://localhost:8080/bundle.js:43969:452)
    at a.Chart.get (http://localhost:8080/bundle.js:44195:343)
    at Object.p [as getSeries] (http://localhost:8080/bundle.js:70706:10589)
    at t.value (http://localhost:8080/bundle.js:70706:47999)
    at http://localhost:8080/bundle.js:63403:25
    at measureLifeCyclePerf (http://localhost:8080/bundle.js:63070:12)
    at ReactCompositeComponentWrapper.unmountComponent (http://localhost:8080/bundle.js:63402:11)
    at Object.unmountComponent (http://localhost:8080/bundle.js:5469:22)
    at ReactCompositeComponentWrapper.unmountComponent (http://localhost:8080/bundle.js:63412:23)
@luzannew
Copy link
Contributor Author

luzannew commented Sep 7, 2017

I have a workaround to disable XAxis.Title and YAxis.Title to fix the AxisTitle unmount issue.

I can also disable the series, but that's the whole point of highcharts ;)

<HighchartsStockChart>
  <Chart zoomType='x' />
  <Legend layout='horizontal' />

  <RangeSelector selected={5}>
    <RangeSelector.Button count={1} type='minute'>1m</RangeSelector.Button>
    <RangeSelector.Button count={1} type='hour'>1h</RangeSelector.Button>
    <RangeSelector.Button count={1} type='day'>1d</RangeSelector.Button>
    <RangeSelector.Button count={2} type='week'>2w</RangeSelector.Button>
    <RangeSelector.Button type='all'>All</RangeSelector.Button>
  </RangeSelector>

  <Tooltip />

  <XAxis id='time'>
    {/* <XAxis.Title>Time</XAxis.Title> */}
  </XAxis>

  <YAxis id='temperature'>
    {/* <YAxis.Title>Temperature (°C)</YAxis.Title> */}
    {
      _.map(series, (item, index) => {
        return <LineSeries key={index} id={index + 'key'} name={item.key} showInNavigator={item.showInNavigator === true} data={item.data} />
      })
    }
  </YAxis>
  <Scrollbar enabled={false} liveRedraw={false} />
  <Navigator />
</HighchartsStockChart>

@whawker whawker closed this as completed in f15826c Sep 8, 2017
@whawker
Copy link
Owner

whawker commented Sep 8, 2017

Just published react-jsx-highcharts@1.3.4-pre.2 and react-jsx-highstock@1.3.4-pre.2 which should fix this issue.

Mind confirming and I'll publish a stable version?

@luzannew
Copy link
Contributor Author

luzannew commented Sep 8, 2017

Problem solved, works for me :) Thanks!

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