From 051cd033f0df97f2ddaf343ade79b1ebbc39fa00 Mon Sep 17 00:00:00 2001 From: Hubert Sosinski Date: Tue, 25 Nov 2025 15:12:26 +0100 Subject: [PATCH 1/4] Cancel navigation span when empty result --- src/components/Search/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 0b1a6b9af512..e7e94df200d0 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -55,7 +55,7 @@ import { shouldShowEmptyState, shouldShowYear as shouldShowYearUtil, } from '@libs/SearchUIUtils'; -import {endSpan, startSpan} from '@libs/telemetry/activeSpans'; +import {endSpan, startSpan, cancelSpan} from '@libs/telemetry/activeSpans'; import {isOnHold, isTransactionPendingDelete, mergeProhibitedViolations, shouldShowViolation} from '@libs/TransactionUtils'; import Navigation, {navigationRef} from '@navigation/Navigation'; import type {SearchFullscreenNavigatorParamList} from '@navigation/types'; @@ -940,6 +940,7 @@ function Search({ const visibleDataLength = data.filter((item) => item.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || isOffline).length; if (shouldShowEmptyState(isDataLoaded, visibleDataLength, searchResults?.search?.type)) { + cancelSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB); return ( Date: Tue, 25 Nov 2025 15:14:13 +0100 Subject: [PATCH 2/4] prettier fix --- src/components/Search/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index e7e94df200d0..1fbe696f33be 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -55,7 +55,7 @@ import { shouldShowEmptyState, shouldShowYear as shouldShowYearUtil, } from '@libs/SearchUIUtils'; -import {endSpan, startSpan, cancelSpan} from '@libs/telemetry/activeSpans'; +import {cancelSpan, endSpan, startSpan} from '@libs/telemetry/activeSpans'; import {isOnHold, isTransactionPendingDelete, mergeProhibitedViolations, shouldShowViolation} from '@libs/TransactionUtils'; import Navigation, {navigationRef} from '@navigation/Navigation'; import type {SearchFullscreenNavigatorParamList} from '@navigation/types'; From 198b920af39f72dc1d28aa9d028db6ad503651bb Mon Sep 17 00:00:00 2001 From: Hubert Sosinski Date: Tue, 25 Nov 2025 15:25:24 +0100 Subject: [PATCH 3/4] add cancel also when hasErrors is true --- src/components/Search/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 1fbe696f33be..87cd3683204d 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -926,6 +926,7 @@ function Search({ if (hasErrors) { const isInvalidQuery = searchRequestResponseStatusCode === CONST.JSON_CODE.INVALID_SEARCH_QUERY; + cancelSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB); return ( Date: Tue, 25 Nov 2025 15:27:31 +0100 Subject: [PATCH 4/4] add cancel also when hasErrors is true --- src/components/Search/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 87cd3683204d..325e3824dadc 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -921,6 +921,7 @@ function Search({ if (searchResults === undefined) { Log.alert('[Search] Undefined search type'); + cancelSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB); return {null}; }