Skip to content

Commit

Permalink
Clicking link in host/user flyout does not refresh details panel (ela…
Browse files Browse the repository at this point in the history
…stic#209863)

## Summary

This PR fixes the issue of navigation link behaviour not updating after
first click/update.


## Testing Steps 
1. Kibana - 8.18 
2. Generate some data using data generator and alerts. 
3. Enable Risk Score
4. Go to Security -> Alerts 
5. Open Host Flyout of a host with risk score 
6. Click alert/risk summary link, then click the other one and observe
the tab on the left and content change in response ✅

### Screen Recordings

#### Host Selected 


https://github.com/user-attachments/assets/ac071adc-8255-496e-956b-cf727191cbe3



#### User Selected 


https://github.com/user-attachments/assets/ab10a640-964d-457f-9ff3-198c19641889

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
CAWilson94 and elasticmachine authored Feb 10, 2025
1 parent d2070ca commit 8c7714a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React, { useMemo, useState } from 'react';
import React, { useEffect, useMemo, useState } from 'react';
import type { FlyoutPanelProps } from '@kbn/expandable-flyout';
import { EntityIdentifierFields, EntityType } from '../../../../common/entity_analytics/types';
import {
Expand Down Expand Up @@ -52,12 +52,17 @@ export const HostDetailsPanel = ({
: EntityDetailsLeftPanelTab.RISK_INPUTS
);

useEffect(() => {
if (path?.tab && path.tab !== selectedTabId) {
setSelectedTabId(path.tab);
}
}, [path?.tab, selectedTabId]);

const [tabs] = useMemo(() => {
const isRiskScoreTabAvailable = isRiskScoreExist && name;
const riskScoreTab = isRiskScoreTabAvailable
? [getRiskInputTab({ entityName: name, entityType: EntityType.host, scopeId })]
: [];

// Determine if the Insights tab should be included
const insightsTab =
hasMisconfigurationFindings || hasVulnerabilitiesFindings || hasNonClosedAlerts
Expand Down

0 comments on commit 8c7714a

Please sign in to comment.