diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c0a5bfb..1e7e23bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fix bug with override creation ([1515](https://github.com/grafana/oncall/pull/1515)) +- Fixed redirection issue on integrations screen ## v1.1.35 (2023-03-09) diff --git a/grafana-plugin/src/pages/integrations/Integrations.tsx b/grafana-plugin/src/pages/integrations/Integrations.tsx index 5c05fddc..26197e02 100644 --- a/grafana-plugin/src/pages/integrations/Integrations.tsx +++ b/grafana-plugin/src/pages/integrations/Integrations.tsx @@ -51,18 +51,23 @@ class Integrations extends React.Component errorData: initErrorDataState(), }; + private isMounted: boolean; private alertReceiveChanneltoPoll: { [key: string]: number } = {}; private alertReceiveChannelTimerId: ReturnType; async componentDidMount() { + this.isMounted = false; this.update().then(() => this.parseQueryParams(true)); } + componentWillUnmount() { + this.isMounted = false; + clearInterval(this.alertReceiveChannelTimerId); + } + componentDidUpdate(prevProps: Readonly): void { if (prevProps.match.params.id && !this.props.match.params.id) { - this.setState({ errorData: initErrorDataState() }, () => { - this.parseQueryParams(); - }); + this.parseQueryParams(); } } @@ -70,7 +75,7 @@ class Integrations extends React.Component const { store, history } = this.props; store.selectedAlertReceiveChannel = alertReceiveChannelId; - if (shouldRedirect) { + if (shouldRedirect && this.isMounted) { history.push(`${PLUGIN_ROOT}/integrations/${alertReceiveChannelId || ''}`); } }; @@ -123,10 +128,6 @@ class Integrations extends React.Component return store.alertReceiveChannelStore.updateItems(); }; - componentWillUnmount() { - clearInterval(this.alertReceiveChannelTimerId); - } - render() { const { store,