[v11.0.x] Dashboard: DashboardPageProxy - Use chaining operators to prevent runtime error (#86536)
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>
(cherry picked from commit 7a147f2ce8)
Co-authored-by: Alexa V <239999+axelavargas@users.noreply.github.com>
This commit is contained in:
co-authored by
Alexa V
parent
2c4277f5f8
commit
d05587b2fd
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user