[Exploratory view] Render content only on expand (#114237)
This commit is contained in:
parent
0b46bb1b93
commit
df971b7dc9
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiFlexItem, EuiFlexGroup, EuiPanel, EuiAccordion, EuiSpacer } from '@elastic/eui';
|
||||
|
@ -47,6 +47,14 @@ export function Series({ item, isExpanded, toggleExpanded }: Props) {
|
|||
seriesId: id,
|
||||
};
|
||||
|
||||
const [isExapndedOnce, setIsExapndedOnce] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (isExpanded) {
|
||||
setIsExapndedOnce(true);
|
||||
}
|
||||
}, [isExpanded]);
|
||||
|
||||
return (
|
||||
<EuiPanel hasBorder={true} data-test-subj={`exploratoryViewSeriesPanel${0}`}>
|
||||
<StyledAccordion
|
||||
|
@ -91,7 +99,7 @@ export function Series({ item, isExpanded, toggleExpanded }: Props) {
|
|||
>
|
||||
<EuiSpacer size="s" />
|
||||
<EuiPanel color="subdued">
|
||||
<ExpandedSeriesRow {...seriesProps} />
|
||||
{isExapndedOnce && <ExpandedSeriesRow {...seriesProps} />}
|
||||
</EuiPanel>
|
||||
</StyledAccordion>
|
||||
</EuiPanel>
|
||||
|
|
Loading…
Reference in a new issue