Skip to content

Commit

Permalink
[Cloud Security]Fix for Broken Session view (#171373)
Browse files Browse the repository at this point in the history
## Summary
This PR is to address the Issue where Session view is broken if User
open it via Clicking Investigate in timeline at Alerts page followed by
clicking the Session view Icon.

The issue is caused by having only 1 ID for the details panel, this
causes issue when User opens 2 Session view and since they both have the
same ID when user tries to close 1, the code basically tries to close
the wrong session view thus causing the issue
  • Loading branch information
animehart authored Nov 16, 2023
1 parent 9396ef3 commit 1d704eb
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { v4 as uuidv4 } from 'uuid';
import React, { useState, useCallback, useEffect, useMemo, useRef } from 'react';
import {
EuiEmptyPrompt,
Expand Down Expand Up @@ -98,6 +99,7 @@ export const SessionView = ({
const [currentJumpToCursor, setCurrentJumpToCursor] = useState(jumpToCursor);
const [currentJumpToEntityId, setCurrentJumpToEntityId] = useState(jumpToEntityId);
const [currentJumpToOutputEntityId, setCurrentJumpToOutputEntityId] = useState('');
const sessionViewId = useMemo(() => `session-view-uuid-${uuidv4()}`, []);

const styles = useStyles({ height, isFullScreen });

Expand Down Expand Up @@ -399,7 +401,7 @@ export const SessionView = ({
<EuiResizableContainer>
{(EuiResizablePanel, EuiResizableButton, { togglePanel }) => {
detailPanelCollapseFn.current = () => {
togglePanel?.('session-detail-panel', { direction: 'left' });
togglePanel?.(sessionViewId, { direction: 'left' });
};

return (
Expand Down Expand Up @@ -458,7 +460,7 @@ export const SessionView = ({

<EuiResizableButton css={styles.resizeHandle} />
<EuiResizablePanel
id="session-detail-panel"
id={sessionViewId}
initialSize={30}
minSize="320px"
paddingSize="none"
Expand Down

0 comments on commit 1d704eb

Please sign in to comment.