[8.9] [Security Solution][Endpoint] Fixes kibana crash when going back to policy details page (#164329) (#164556)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Security Solution][Endpoint] Fixes kibana crash when going back to
policy details page
(#164329)](https://github.com/elastic/kibana/pull/164329)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"David
Sánchez","email":"david.sanchezsoler@elastic.co"},"sourceCommit":{"committedDate":"2023-08-23T10:44:11Z","message":"[Security
Solution][Endpoint] Fixes kibana crash when going back to policy details
page (#164329)\n\nFixes:
https://github.com/elastic/kibana/issues/164295\r\nFixes:
https://github.com/elastic/kibana/issues/164190\r\n\r\n##
Summary\r\nThere was a Kibana crash when using back link buttons to go
back to the\r\npolicy details page from Trusted Apps / Event Filters /
Host Isolation\r\nexceptions / Blocklists page. Route state can be null
depending on the\r\nprevious action so it has to be
conditional.\r\n\r\nThe error occurs when it tries to access the
`backLink` prop on\r\n`routeState` when it's not
defined.\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"fb79e3e86430418c8a10d1cb9041c5e4f901a436","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend
Workflows","v8.10.0","v8.11.0","v8.9.2"],"number":164329,"url":"https://github.com/elastic/kibana/pull/164329","mergeCommit":{"message":"[Security
Solution][Endpoint] Fixes kibana crash when going back to policy details
page (#164329)\n\nFixes:
https://github.com/elastic/kibana/issues/164295\r\nFixes:
https://github.com/elastic/kibana/issues/164190\r\n\r\n##
Summary\r\nThere was a Kibana crash when using back link buttons to go
back to the\r\npolicy details page from Trusted Apps / Event Filters /
Host Isolation\r\nexceptions / Blocklists page. Route state can be null
depending on the\r\nprevious action so it has to be
conditional.\r\n\r\nThe error occurs when it tries to access the
`backLink` prop on\r\n`routeState` when it's not
defined.\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"fb79e3e86430418c8a10d1cb9041c5e4f901a436"}},"sourceBranch":"main","suggestedTargetBranches":["8.10","8.9"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164329","number":164329,"mergeCommit":{"message":"[Security
Solution][Endpoint] Fixes kibana crash when going back to policy details
page (#164329)\n\nFixes:
https://github.com/elastic/kibana/issues/164295\r\nFixes:
https://github.com/elastic/kibana/issues/164190\r\n\r\n##
Summary\r\nThere was a Kibana crash when using back link buttons to go
back to the\r\npolicy details page from Trusted Apps / Event Filters /
Host Isolation\r\nexceptions / Blocklists page. Route state can be null
depending on the\r\nprevious action so it has to be
conditional.\r\n\r\nThe error occurs when it tries to access the
`backLink` prop on\r\n`routeState` when it's not
defined.\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"fb79e3e86430418c8a10d1cb9041c5e4f901a436"}},{"branch":"8.9","label":"v8.9.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: David Sánchez <david.sanchezsoler@elastic.co>
This commit is contained in:
Kibana Machine 2023-08-23 07:59:27 -04:00 committed by GitHub
parent b3a4723498
commit 06368c20aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,7 +60,7 @@ export const PolicyDetails = React.memo(() => {
},
],
};
}, [getAppUrl, routeState.backLink]);
}, [getAppUrl, routeState?.backLink]);
const headerRightContent = (
<AgentsSummary