[9.5] [Entity Analytics] Fix entity summary showing stale content when switching to entity with no summary (#285247) - #288448
Merged
Conversation
…ching to entity with no summary (elastic#285247) ## Summary Fixes elastic/security-team#18414. When switching from an entity with a persisted AI summary to one without, the **Entity summary** section continued to show the previous entity's content. The flyout header and risk badge updated correctly; only the summary was stale. **Root cause:** The stored-summary hydration effect in `useFetchEntityDetailsHighlights` only ran its body when `storedSummary` was truthy, so `assistantResult` was never cleared when `storedSummary` became `null`: ```typescript // Before useEffect(() => { if (storedSummary && !userTriggeredGeneration.current) { setAssistantResult(buildResultFromStoredSummary(storedSummary)); } }, [storedSummary]); ``` **Fix:** Add the else branch so `assistantResult` is cleared when `storedSummary` becomes `null` and the user has not triggered generation in the current mount cycle: ```typescript // After useEffect(() => { if (userTriggeredGeneration.current) return; setAssistantResult(storedSummary ? buildResultFromStoredSummary(storedSummary) : null); }, [storedSummary]); ``` This is a client-side state management fix only - no API, schema, or index changes. ## Demo https://github.com/user-attachments/assets/32934f34-2a79-41d1-b420-eb5fbc80a95e ## Desk Testing 1. Open entity flyout for a user/host entity that has a persisted AI summary — confirm summary shows 2. Without closing the flyout, switch to a user/host entity that has **no** persisted summary — confirm the Entity summary section shows the Generate state (not the previous entity's summary) 3. Switching between two entities that **both** have summaries should still work correctly 4. Service entities unaffected Unit test added: `clears the result when switching to an entity that has no stored summary` 🤖 Generated with [Claude Code](https://claude.com/claude-code) (cherry picked from commit 5846418)
CAWilson94
enabled auto-merge (squash)
September 1, 2026 15:35
kibanamachine
requested review from
romulets
and removed request for
kibanamachine
September 1, 2026 15:35
ymao1
approved these changes
Sep 1, 2026
Contributor
💚 Build Succeeded
Metrics [docs]Async chunks
|
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
mainto9.5:Questions ?
Please refer to the Backport tool documentation