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
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,7 @@ const CONST = {
TAG_ACTIVE_POLICY: 'active_policy_id',
SPAN_OPEN_REPORT: 'ManualOpenReport',
SPAN_APP_STARTUP: 'ManualAppStartup',
SPAN_OPEN_SEARCH_ROUTER: 'ManualOpenSearchRouter',
},
PRIORITY_MODE: {
GSD: 'gsd',
Expand Down
2 changes: 2 additions & 0 deletions src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
} from '@libs/SearchQueryUtils';
import {getDatePresets, getHasOptions} from '@libs/SearchUIUtils';
import StringUtils from '@libs/StringUtils';
import {endSpan} from '@libs/telemetry/activeSpans';
import Timing from '@userActions/Timing';
import CONST, {CONTINUATION_DETECTION_SEARCH_FILTER_KEYS} from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -120,6 +121,7 @@ const defaultListOptions = {
const setPerformanceTimersEnd = () => {
Timing.end(CONST.TIMING.OPEN_SEARCH);
Performance.markEnd(CONST.TIMING.OPEN_SEARCH);
endSpan(CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER);
};

function isSearchQueryListItem(listItem: UserListItemProps<OptionData> | SearchQueryListItemProps): listItem is SearchQueryListItemProps {
Expand Down
5 changes: 5 additions & 0 deletions src/components/Search/SearchRouter/SearchButton.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, {useRef} from 'react';
import type {StyleProp, View, ViewStyle} from 'react-native';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 4 in src/components/Search/SearchRouter/SearchButton.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 4 in src/components/Search/SearchRouter/SearchButton.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import {PressableWithoutFeedback} from '@components/Pressable';
import Tooltip from '@components/Tooltip';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import Performance from '@libs/Performance';
import {startSpan} from '@libs/telemetry/activeSpans';
import {callFunctionIfActionIsAllowed} from '@userActions/Session';
import Timing from '@userActions/Timing';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -39,6 +40,10 @@

Timing.start(CONST.TIMING.OPEN_SEARCH);
Performance.markStart(CONST.TIMING.OPEN_SEARCH);
startSpan(CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe would be good to track from where it was triggered? Adding sourceRoute to the attributes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isn't the previous/current route already tracked in the parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can track this using breadcrumbs

name: CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER,
op: CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER,
});

openSearchRouter();
})}
Expand Down
14 changes: 14 additions & 0 deletions src/components/Search/SearchRouter/SearchRouterContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React, {useContext, useEffect, useMemo, useRef, useState} from 'react';
import type {AnimatedTextInputRef} from '@components/RNTextInput';
import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute';
import {navigationRef} from '@libs/Navigation/Navigation';
import {startSpan} from '@libs/telemetry/activeSpans';
import {close} from '@userActions/Modal';
import CONST from '@src/CONST';
import NAVIGATORS from '@src/NAVIGATORS';
import SCREENS from '@src/SCREENS';
import type ChildrenProps from '@src/types/utils/ChildrenProps';
Expand Down Expand Up @@ -92,6 +94,16 @@ function SearchRouterContextProvider({children}: ChildrenProps) {
}
};

const startSearchRouterOpenSpan = () => {
startSpan(CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER, {
name: CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER,
op: CONST.TELEMETRY.SPAN_OPEN_SEARCH_ROUTER,
attributes: {
trigger: 'keyboard',
},
});
};

// There are callbacks that live outside of React render-loop and interact with SearchRouter
// So we need a function that is based on ref to correctly open/close it
// When user is on `/search` page we focus the Input instead of showing router
Expand All @@ -104,11 +116,13 @@ function SearchRouterContextProvider({children}: ChildrenProps) {
if (searchPageInputRef.current.isFocused()) {
searchPageInputRef.current.blur();
} else {
startSearchRouterOpenSpan();
searchPageInputRef.current.focus();
}
} else if (searchRouterDisplayedRef.current) {
closeSearchRouter();
} else {
startSearchRouterOpenSpan();
openSearchRouter();
}
};
Expand Down
Loading