Fixes React errors+crash when system theme changes on loaded dashboard (#1123)

* Fixes crash on theme change

* Changelog
This commit is contained in:
Vignesh Joglekar 2021-06-14 08:44:46 -05:00 committed by GitHub
parent 39287ab176
commit 645069271a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.
- Fix weekly report time range plausible/analytics#951
- Make sure embedded dashboards can run when user has blocked third-party cookies plausible/analytics#971
- Sites listing page will paginate if the user has a lot of sites plausible/analytics#994
- Crash when changing theme on a loaded dashboard plausible/analytics#1123
### Removed
- Removes AppSignal monitoring package

View File

@ -34,7 +34,7 @@ class Countries extends React.Component {
componentDidUpdate(prevProps) {
if (this.props.query !== prevProps.query) {
this.setState({loading: true, countries: null})
this.fetchCountries().then(this.drawMap.bind(this))
this.fetchCountries().then(this.drawMap)
}
if (this.props.darkTheme !== prevProps.darkTheme) {
@ -42,7 +42,7 @@ class Countries extends React.Component {
document.getElementById('map-container').removeChild(document.querySelector('.datamaps-hoverover'));
document.getElementById('map-container').removeChild(document.querySelector('.datamap'));
}
this.drawMap();
this.fetchCountries().then(this.drawMap)
}
}

View File

@ -202,6 +202,7 @@ class LineGraph extends React.Component {
}
if (prevProps.darkTheme !== this.props.darkTheme) {
this.chart.destroy();
this.chart = this.regenerateChart();
this.chart.update();
}