Skip to content

Commit b1afdea

Browse files
committed
End ManualSubmitToDestinationVisible on skeleton paint
1 parent d7fdd97 commit b1afdea

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/components/Search/SearchWithNavigationDeferredMount.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,25 @@ import SearchRowSkeleton from '@components/Skeletons/SearchRowSkeleton';
55
import useResponsiveLayout from '@hooks/useResponsiveLayout';
66
import useThemeStyles from '@hooks/useThemeStyles';
77
import {endSpanWithAttributes} from '@libs/telemetry/activeSpans';
8+
import {endSubmitFollowUpActionSpan, getPendingSubmitFollowUpAction} from '@libs/telemetry/submitFollowUpAction';
89
import CONST from '@src/CONST';
910
import Search from './index';
1011

1112
const REASON_ATTRIBUTES = {context: 'SearchPage.NavigationDeferred'} as const;
1213

14+
function handleSkeletonLayout() {
15+
endSpanWithAttributes(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS, {[CONST.TELEMETRY.ATTRIBUTE_IS_WARM]: true});
16+
17+
// Skeleton paint is the first user-perceivable signal that the submit destination
18+
// (Search) is up. End the submit-to-destination-visible span here for any pending
19+
// action that targets Search. DISMISS_MODAL_AND_OPEN_REPORT is excluded because
20+
// that flow's destination is the report, not Search.
21+
const pending = getPendingSubmitFollowUpAction();
22+
if (pending && pending.followUpAction !== CONST.TELEMETRY.SUBMIT_FOLLOW_UP_ACTION.DISMISS_MODAL_AND_OPEN_REPORT) {
23+
endSubmitFollowUpActionSpan(pending.followUpAction, undefined, {[CONST.TELEMETRY.ATTRIBUTE_IS_WARM]: true});
24+
}
25+
}
26+
1327
function SearchWithNavigationDeferredMount(props: ComponentProps<typeof Search>) {
1428
const styles = useThemeStyles();
1529
const {shouldUseNarrowLayout} = useResponsiveLayout();
@@ -21,7 +35,7 @@ function SearchWithNavigationDeferredMount(props: ComponentProps<typeof Search>)
2135
placeholder={
2236
<SearchRowSkeleton
2337
shouldAnimate
24-
onLayout={() => endSpanWithAttributes(CONST.TELEMETRY.SPAN_NAVIGATE_TO_REPORTS, {[CONST.TELEMETRY.ATTRIBUTE_IS_WARM]: true})}
38+
onLayout={handleSkeletonLayout}
2539
containerStyle={containerStyle}
2640
reasonAttributes={REASON_ATTRIBUTES}
2741
/>

0 commit comments

Comments
 (0)