Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Mobile-Expensify
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,7 @@ const CONST = {
SPAN_OPEN_REPORT: 'ManualOpenReport',
SPAN_APP_STARTUP: 'ManualAppStartup',
SPAN_NAVIGATE_TO_REPORTS_TAB: 'ManualNavigateToReportsTab',
SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER: 'ManualNavigateToReportsTabRender',
SPAN_ON_LAYOUT_SKELETON_REPORTS: 'ManualOnLayoutSkeletonReports',
SPAN_NAVIGATE_TO_INBOX_TAB: 'ManualNavigateToInboxTab',
SPAN_OD_ND_TRANSITION: 'ManualOdNdTransition',
Expand Down
3 changes: 2 additions & 1 deletion src/components/Navigation/NavigationTabBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,15 @@ function NavigationTabBar({selectedTab, isTopLevelBar = false, shouldShowFloatin
}
clearSelectedText();
interceptAnonymousUser(() => {
startSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB, {
const parentSpan = startSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB, {
name: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB,
op: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB,
});

startSpan(CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS, {
name: CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS,
op: CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS,
parentSpan,
});

const rootState = navigationRef.getRootState() as State<RootNavigatorParamList>;
Expand Down
24 changes: 23 additions & 1 deletion src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import {
shouldShowEmptyState,
shouldShowYear as shouldShowYearUtil,
} from '@libs/SearchUIUtils';
import {cancelSpan, endSpan, startSpan} from '@libs/telemetry/activeSpans';
import {cancelSpan, endSpan, getSpan, startSpan} from '@libs/telemetry/activeSpans';
import {getOriginalTransactionWithSplitInfo, hasValidModifiedAmount, isOnHold, isTransactionPendingDelete} from '@libs/TransactionUtils';
import Navigation, {navigationRef} from '@navigation/Navigation';
import type {SearchFullscreenNavigatorParamList} from '@navigation/types';
Expand Down Expand Up @@ -941,9 +941,31 @@ function Search({

const onLayout = useCallback(() => {
endSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB);
endSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER);
handleSelectionListScroll(sortedData, searchListRef.current);
}, [handleSelectionListScroll, sortedData]);

useEffect(() => {
if (shouldShowLoadingState) {
return;
}

const renderSpanParent = getSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB);

if (renderSpanParent) {
startSpan(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER, {
name: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER,
op: CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS_TAB_RENDER,
parentSpan: renderSpanParent,
}).setAttributes({
inputQuery: queryJSON?.inputQuery,
});
}

// Exclude `queryJSON?.inputQuery` since it’s only telemetry metadata and would cause the span to start multiple times.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [shouldShowLoadingState]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}, [shouldShowLoadingState]);
// Exclude `queryJSON?.inputQuery` since it’s only telemetry metadata and would cause the span to start multiple times.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [shouldShowLoadingState]);

Please add // eslint-disable-next-line react-hooks/exhaustive-deps if we intentionally don’t want to add queryJSON?.inputQuery to the dependency array, and add a comment explaining why this rule is disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


const onLayoutSkeleton = useCallback(() => {
endSpan(CONST.TELEMETRY.SPAN_ON_LAYOUT_SKELETON_REPORTS);
}, []);
Expand Down
Loading