diff --git a/frontend/src/api/trace/getTraceV2.tsx b/frontend/src/api/trace/getTraceV2.tsx index 23a4c0454c..d9e686a387 100644 --- a/frontend/src/api/trace/getTraceV2.tsx +++ b/frontend/src/api/trace/getTraceV2.tsx @@ -12,9 +12,19 @@ const getTraceV2 = async ( props: GetTraceV2PayloadProps, ): Promise | ErrorResponse> => { try { + let uncollapsedNodes = [...props.uncollapsedNodes]; + if (!props.isInterestedSpanIdUnCollapsed) { + uncollapsedNodes = uncollapsedNodes.filter( + (node) => node !== props.interestedSpanId, + ); + } + const postData: GetTraceV2PayloadProps = { + ...props, + uncollapsedNodes, + }; const response = await axios.post( `/traces/${props.traceId}`, - omit(props, 'traceId'), + omit(postData, 'traceId'), ); return {