react-break
Advanced tools
Comparing version
@@ -84,3 +84,3 @@ 'use strict'; | ||
_this.forceUpdate(); | ||
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret); | ||
}, _this.mounted = false, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret); | ||
} | ||
@@ -91,2 +91,3 @@ | ||
value: function componentDidMount() { | ||
this.mounted = true; | ||
this.onBreakpointsChange(); | ||
@@ -97,2 +98,3 @@ } | ||
value: function componentWillUnmount() { | ||
this.mounted = false; | ||
this.state.layout.removeChangeListener(this.onLayoutChange); | ||
@@ -103,5 +105,7 @@ } | ||
value: function onBreakpointsChange() { | ||
this.setState({ layout: (0, _breakjs2.default)(this.props.breakpoints) }); | ||
this.state.layout.removeChangeListener(this.onLayoutChange); | ||
this.state.layout.addChangeListener(this.onLayoutChange); | ||
if (this.mounted) { | ||
this.setState({ layout: (0, _breakjs2.default)(this.props.breakpoints) }); | ||
this.state.layout.removeChangeListener(this.onLayoutChange); | ||
this.state.layout.addChangeListener(this.onLayoutChange); | ||
} | ||
} | ||
@@ -108,0 +112,0 @@ }, { |
{ | ||
"name": "react-break", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Responsive breakpoints in React.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/react-break.js", |
@@ -34,2 +34,3 @@ import React, { PureComponent } from 'react'; | ||
componentDidMount() { | ||
this.mounted = true; | ||
this.onBreakpointsChange(); | ||
@@ -39,2 +40,3 @@ } | ||
componentWillUnmount() { | ||
this.mounted = false; | ||
this.state.layout.removeChangeListener(this.onLayoutChange); | ||
@@ -44,5 +46,7 @@ } | ||
onBreakpointsChange() { | ||
this.setState({ layout: breakjs(this.props.breakpoints) }); | ||
this.state.layout.removeChangeListener(this.onLayoutChange); | ||
this.state.layout.addChangeListener(this.onLayoutChange); | ||
if (this.mounted) { | ||
this.setState({ layout: breakjs(this.props.breakpoints) }); | ||
this.state.layout.removeChangeListener(this.onLayoutChange); | ||
this.state.layout.addChangeListener(this.onLayoutChange); | ||
} | ||
} | ||
@@ -54,2 +58,4 @@ | ||
mounted = false | ||
render() { | ||
@@ -56,0 +62,0 @@ const { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
647911
0.05%2041
0.44%0
-100%