Dashboard: Ignore cancelled api request error when loading dashboard (#27232)

This commit is contained in:
Torkel Ödegaard
2020-08-27 08:55:26 +02:00
committed by GitHub
parent 1e8b10ef05
commit 5e27654298
2 changed files with 6 additions and 6 deletions

View File

@@ -68,11 +68,6 @@ async function fetchDashboard(
// load home dash
const dashDTO: DashboardDTO = await backendSrv.get('/api/dashboards/home');
// if above all is cancelled it will return an array
if (Array.isArray(dashDTO)) {
return null;
}
// if user specified a custom home dashboard redirect to that
if (dashDTO.redirectUri) {
const newUrl = locationUtil.stripBaseFromUrl(dashDTO.redirectUri);
@@ -116,6 +111,11 @@ async function fetchDashboard(
throw { message: 'Unknown route ' + args.routeInfo };
}
} catch (err) {
// Ignore cancelled errors
if (err.cancelled) {
return null;
}
dispatch(dashboardInitFailed({ message: 'Failed to fetch dashboard', error: err }));
console.error(err);
return null;