Skip to content

Commit 19ad71f

Browse files
committed
ContainerQuery no longer tries to set state for an unmounting component
1 parent 72434af commit 19ad71f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [2.4.2]
11+
12+
### Fixed
13+
14+
* `react-container-query`
15+
* `ContainerQuery` no longer tries to set state for an unmounting component
16+
1017
## [2.4.1]
1118

1219
### Fixed

packages/react-container-query/src/ContainerQuery.js

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export default class ContainerQuery extends Component {
1818
}
1919

2020
handleResize(size) {
21+
if (this.unMounting) {
22+
return;
23+
}
24+
2125
this.setState({ size });
2226
}
2327

@@ -46,6 +50,10 @@ export default class ContainerQuery extends Component {
4650
}
4751
}
4852

53+
componentWillUnmount() {
54+
this.unMounting = true;
55+
}
56+
4957
render() {
5058
return this.props.render(this.state.size);
5159
}

0 commit comments

Comments
 (0)