Skip to content

Commit

Permalink
[APM] Trace timeline: Multi-fold function doesn't update when all acc…
Browse files Browse the repository at this point in the history
…ordions are collapsed or expanded (#76899)

* update outside state when expanding or collapsing the entry transaction

* reverting icons
  • Loading branch information
cauemarcondes authored Sep 8, 2020
1 parent 2f1c012 commit dc28e0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ interface AccordionWaterfallProps {
location: Location;
errorsPerTransaction: IWaterfall['errorsPerTransaction'];
childrenByParentId: Record<string, IWaterfallItem[]>;
onToggleEntryTransaction?: (
nextState: EuiAccordionProps['forceState']
) => void;
onToggleEntryTransaction?: () => void;
timelineMargins: Margins;
onClickWaterfallItem: (item: IWaterfallItem) => void;
}
Expand Down Expand Up @@ -106,6 +104,7 @@ export function AccordionWaterfall(props: AccordionWaterfallProps) {
errorsPerTransaction,
timelineMargins,
onClickWaterfallItem,
onToggleEntryTransaction,
} = props;

const nextLevel = level + 1;
Expand Down Expand Up @@ -147,7 +146,12 @@ export function AccordionWaterfall(props: AccordionWaterfallProps) {
arrowDisplay={isEmpty(children) ? 'none' : 'left'}
initialIsOpen={true}
forceState={isOpen ? 'open' : 'closed'}
onToggle={() => setIsOpen((isCurrentOpen) => !isCurrentOpen)}
onToggle={() => {
setIsOpen((isCurrentOpen) => !isCurrentOpen);
if (onToggleEntryTransaction) {
onToggleEntryTransaction();
}
}}
>
{children.map((child) => (
<AccordionWaterfall
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export function Waterfall({
onClickWaterfallItem={(item: IWaterfallItem) =>
toggleFlyout({ history, item, location })
}
onToggleEntryTransaction={() => setIsAccordionOpen((isOpen) => !isOpen)}
/>
);
}
Expand Down

0 comments on commit dc28e0e

Please sign in to comment.