-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EDR Workflows] Proper undefined routeState handling #181432
[EDR Workflows] Proper undefined routeState handling #181432
Conversation
Pinging @elastic/security-defend-workflows (Team:Defend Workflows) |
/ci |
@@ -457,7 +457,7 @@ export const PolicyTabs = React.memo(() => { | |||
cancelUnsavedChangesModal, | |||
history, | |||
policyId, | |||
routeState.backLink, | |||
routeState?.backLink, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only change that fixes the issue. Right? I'm not sure what the nextTabId
is needed for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's only additional testing: nextTabId
is in the artifact_page.ts
fixture which is used to click through the artifact tabs on Policy Details page. so with nextTabId
an additional click to the neighbour tab is added, to cover this situation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ashokaditya What @gergoabraham said :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, couldn't break it! 🚀 thanks for extending the test cases!
/ci |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
elastic#181261 Check if `routeState` is defined before accessing it's properties in `useCallback` dependency list. With changes: https://github.com/elastic/kibana/assets/29123534/4561c5d6-e354-4e0b-ac8a-dd231a26d722 Cypress tests when no undefined check is performed (application throws): ![Screenshot 2024-04-23 at 14 46 37](https://github.com/elastic/kibana/assets/29123534/ed7817dc-f11c-4f5e-bdf3-c6ee9f4c8ea6) (cherry picked from commit 800289c)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…#181529) # Backport This will backport the following commits from `main` to `8.14`: - [[EDR Workflows] Proper undefined routeState handling (#181432)](#181432) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Konrad Szwarc","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-04-24T08:59:00Z","message":"[EDR Workflows] Proper undefined routeState handling (#181432)\n\nhttps://github.com//issues/181261\r\n\r\nCheck if `routeState` is defined before accessing it's properties in\r\n`useCallback` dependency list.\r\n\r\nWith changes:\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/29123534/4561c5d6-e354-4e0b-ac8a-dd231a26d722\r\n\r\nCypress tests when no undefined check is performed (application throws):\r\n![Screenshot 2024-04-23 at 14 46\r\n37](https://github.com/elastic/kibana/assets/29123534/ed7817dc-f11c-4f5e-bdf3-c6ee9f4c8ea6)","sha":"800289c506aeceb7e1dffa650481d7e10dc5e70c","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend Workflows","v8.14.0","v8.15.0"],"title":"[EDR Workflows] Proper undefined routeState handling","number":181432,"url":"https://github.com/elastic/kibana/pull/181432","mergeCommit":{"message":"[EDR Workflows] Proper undefined routeState handling (#181432)\n\nhttps://github.com//issues/181261\r\n\r\nCheck if `routeState` is defined before accessing it's properties in\r\n`useCallback` dependency list.\r\n\r\nWith changes:\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/29123534/4561c5d6-e354-4e0b-ac8a-dd231a26d722\r\n\r\nCypress tests when no undefined check is performed (application throws):\r\n![Screenshot 2024-04-23 at 14 46\r\n37](https://github.com/elastic/kibana/assets/29123534/ed7817dc-f11c-4f5e-bdf3-c6ee9f4c8ea6)","sha":"800289c506aeceb7e1dffa650481d7e10dc5e70c"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/181432","number":181432,"mergeCommit":{"message":"[EDR Workflows] Proper undefined routeState handling (#181432)\n\nhttps://github.com//issues/181261\r\n\r\nCheck if `routeState` is defined before accessing it's properties in\r\n`useCallback` dependency list.\r\n\r\nWith changes:\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/29123534/4561c5d6-e354-4e0b-ac8a-dd231a26d722\r\n\r\nCypress tests when no undefined check is performed (application throws):\r\n![Screenshot 2024-04-23 at 14 46\r\n37](https://github.com/elastic/kibana/assets/29123534/ed7817dc-f11c-4f5e-bdf3-c6ee9f4c8ea6)","sha":"800289c506aeceb7e1dffa650481d7e10dc5e70c"}}]}] BACKPORT--> Co-authored-by: Konrad Szwarc <[email protected]>
#181261
Check if
routeState
is defined before accessing it's properties inuseCallback
dependency list.With changes:
Screen.Recording.2024-04-23.at.14.22.00.mov
Cypress tests when no undefined check is performed (application throws):