diff --git a/.betterer.results b/.betterer.results index 5285c2ba873..103fa0be511 100644 --- a/.betterer.results +++ b/.betterer.results @@ -3012,8 +3012,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/core/components/SharedPreferences/SharedPreferences.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/core/components/TagFilter/TagBadge.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], diff --git a/public/app/core/components/SharedPreferences/SharedPreferences.tsx b/public/app/core/components/SharedPreferences/SharedPreferences.tsx index 2fcd57379f6..f850ca9a7eb 100644 --- a/public/app/core/components/SharedPreferences/SharedPreferences.tsx +++ b/public/app/core/components/SharedPreferences/SharedPreferences.tsx @@ -111,27 +111,13 @@ export class SharedPreferences extends PureComponent { async componentDidMount() { const prefs = await this.service.load(); - const dashboards = (await backendSrv.search({ starred: true })) as DashboardSearchItem[]; + const dashboards = await backendSrv.search({ starred: true }); if (prefs.homeDashboardUID && !dashboards.find((d) => d.uid === prefs.homeDashboardUID)) { - const missingDash = await backendSrv.getDashboardByUid(prefs.homeDashboardUID); + const missingDash = await backendSrv.search({ dashboardUIDs: prefs.homeDashboardUID }); - if (missingDash?.dashboard) { - dashboards.push({ - title: missingDash.dashboard.title, - tags: [], - type: DashboardSearchItemType.DashDB, - uid: missingDash.dashboard.uid, - uri: '', // uri is not part of dashboard metadata - url: missingDash.meta.url || '', - folderId: missingDash.meta.folderId, - folderTitle: missingDash.meta.folderTitle, - folderUid: missingDash.meta.folderUid, - folderUrl: missingDash.meta.folderUrl, - isStarred: missingDash.meta.isStarred || false, - slug: missingDash.meta.slug, - items: [], - }); + if (missingDash.length > 0) { + dashboards.push(missingDash[0]); } }