react-bootstrap-slider icon indicating copy to clipboard operation
react-bootstrap-slider copied to clipboard

componentWillUnmount should destroy gracefully

Open zeroasterisk opened this issue 7 years ago • 3 comments

If the component is unmounted before fully rendered, it throws an error...

Resolves the following error:

render.js:69 TypeError: Cannot read property 'destroy' of undefined
    at ReactBootstrapSlider.componentWillUnmount (react-bootstrap-slider.js:158)
    at ReactCompositeComponent.js:406
    at measureLifeCyclePerf (ReactCompositeComponent.js:73)
    at ReactCompositeComponentWrapper.unmountComponent (ReactCompositeComponent.js:405)
    at Object.unmountComponent (ReactReconciler.js:76)
    at Object.unmountChildren (ReactChildReconciler.js:144)
    at ReactDOMComponent.unmountChildren (ReactMultiChild.js:369)
    at ReactDOMComponent.unmountComponent (ReactDOMComponent.js:992)
    at Object.unmountComponent (ReactReconciler.js:76)
    at Object.unmountChildren (ReactChildReconciler.js:144)

zeroasterisk avatar Oct 20 '17 19:10 zeroasterisk

Thanks for the PR. It passes all tests.

Before I merge, could you tell me under what circumstances you would unmount the component before it's rendered? Maybe supply some example code too.

brownieboy avatar Oct 21 '17 03:10 brownieboy

I'm not doing it intentionally but it is happening when loading inside of react storybook.

It is likely when something starts with any component and internal State change and stops it before it's finished loading, and then perhaps starts again afterwards

zeroasterisk avatar Oct 21 '17 14:10 zeroasterisk

Okay, can I see some sample code, please? Do you have a Github project that I can check out?

brownieboy avatar Oct 22 '17 02:10 brownieboy