[8.x] [SecuritySolution] Make last conversation local storage keys space aware (#214794)#216085
Merged
kibanamachine merged 2 commits intoelastic:8.xfrom Mar 27, 2025
Merged
Conversation
1 task
…are (elastic#214794) ## Summary Issue and steps to reproduce: elastic#214114 https://github.com/user-attachments/assets/881fb082-a879-4816-b251-da3f2af77661 The best approach to fix this is to make local storage keys space aware. In this use case, the current key is `elasticAssistantDefault.lastSelectedConversation`. Ideally it should be e.g.: `elasticAssistantDefault.lastSelectedConversation.{spaceId}` To retrieve spaceId properly, we have to make sure spaceId has been available when reading the local storage. In other words, the spaceId cannot be null, undefined, or a fallback value when accessing it. To achieve that, we have to only render the assistant overlay after spaceId is available and remove existing spaceId from the AssistantContext. The reason I removed spaceId from AssistantContext is because it is at the top of the rendering tree and can block the entire app if waiting for the spaceId becomes available there. `useAssistantSpaceId` comes from `SpaceIdContext` which should be render only when spaceId is available, should be safe to access the exact spaceId inside Assistant overly. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 169abec)
6fb7244 to
54f296e
Compare
Contributor
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Historycc @angorayc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.x:Questions ?
Please refer to the Backport tool documentation