mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard: DashboardPageProxy - Use chaining operators to prevent runtime error (#86507)
* Use chaining operators to prevent runtime error * Fix tests --------- Co-authored-by: Ivan Ortega <ivanortegaalba@gmail.com>
This commit is contained in:
parent
e65669bc0d
commit
7a147f2ce8
@ -147,7 +147,7 @@ describe('DashboardPageProxy', () => {
|
||||
act(() => {
|
||||
setup({
|
||||
route: { routeName: DashboardRoutes.Home, component: () => null, path: '/' },
|
||||
match: { params: {}, isExact: true, path: '/', url: '/' },
|
||||
match: { params: { uid: '' }, isExact: true, path: '/', url: '/' },
|
||||
});
|
||||
});
|
||||
|
||||
@ -176,7 +176,14 @@ describe('DashboardPageProxy', () => {
|
||||
act(() => {
|
||||
setup({
|
||||
route: { routeName: DashboardRoutes.Home, component: () => null, path: '/' },
|
||||
match: { params: {}, isExact: true, path: '/', url: '/' },
|
||||
match: {
|
||||
params: {
|
||||
uid: '',
|
||||
},
|
||||
isExact: true,
|
||||
path: '/',
|
||||
url: '/',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -54,7 +54,7 @@ function DashboardPageProxy(props: DashboardPageProxyProps) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (dashboard.value && dashboard.value.dashboard.uid && dashboard.value.dashboard.uid !== props.match.params.uid) {
|
||||
if (dashboard?.value?.dashboard?.uid !== props.match.params.uid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user