diff --git a/src/components/Search/SearchAutocompleteList.tsx b/src/components/Search/SearchAutocompleteList.tsx index 9e20acb46853f..aa1aa4fa66b62 100644 --- a/src/components/Search/SearchAutocompleteList.tsx +++ b/src/components/Search/SearchAutocompleteList.tsx @@ -31,6 +31,7 @@ import {getReportOrDraftReport} from '@libs/ReportUtils'; import {buildSearchQueryJSON, buildUserReadableQueryString, getQueryWithoutFilters, shouldHighlight} from '@libs/SearchQueryUtils'; import StringUtils from '@libs/StringUtils'; import {cancelSpan, endSpan, getSpan} from '@libs/telemetry/activeSpans'; +import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {CardFeeds, CardList, PersonalDetailsList, Policy, Report} from '@src/types/onyx'; @@ -437,12 +438,19 @@ function SearchAutocompleteList({ const isLoading = !isRecentSearchesDataLoaded || !areOptionsInitialized; + const reasonAttributes: SkeletonSpanReasonAttributes = { + context: 'SearchAutocompleteList', + isRecentSearchesDataLoaded, + areOptionsInitialized, + }; + if (isLoading) { return ( ); } diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index 2397adea8fb0b..025e6ca249751 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -17,6 +17,7 @@ import useScrollEnabled from '@hooks/useScrollEnabled'; import useSingleExecution from '@hooks/useSingleExecution'; import {focusedItemRef} from '@hooks/useSyncFocus/useSyncFocusImplementation'; import useThemeStyles from '@hooks/useThemeStyles'; +import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan'; import CONST from '@src/CONST'; import getEmptyArray from '@src/types/utils/getEmptyArray'; import Footer from './components/Footer'; @@ -367,7 +368,19 @@ function BaseSelectionList({ const renderListEmptyContent = () => { if (shouldShowLoadingPlaceholder) { - return customLoadingPlaceholder ?? ; + const reasonAttributes: SkeletonSpanReasonAttributes = { + context: 'BaseSelectionList', + shouldShowLoadingPlaceholder, + shouldUseUserSkeletonView, + }; + return ( + customLoadingPlaceholder ?? ( + + ) + ); } if (shouldShowListEmptyContent) { return listEmptyContent; diff --git a/src/components/SelectionList/SelectionListWithSections/BaseSelectionListWithSections.tsx b/src/components/SelectionList/SelectionListWithSections/BaseSelectionListWithSections.tsx index 064f258f42a6e..545c43c2f0cf6 100644 --- a/src/components/SelectionList/SelectionListWithSections/BaseSelectionListWithSections.tsx +++ b/src/components/SelectionList/SelectionListWithSections/BaseSelectionListWithSections.tsx @@ -27,6 +27,7 @@ import useSingleExecution from '@hooks/useSingleExecution'; import {focusedItemRef} from '@hooks/useSyncFocus/useSyncFocusImplementation'; import useThemeStyles from '@hooks/useThemeStyles'; import Log from '@libs/Log'; +import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan'; import CONST from '@src/CONST'; import type {FlattenedItem, ListItem, SelectionListWithSectionsProps} from './types'; @@ -282,7 +283,11 @@ function BaseSelectionListWithSections({ const renderListEmptyContent = () => { if (shouldShowLoadingPlaceholder) { - return ; + const reasonAttributes: SkeletonSpanReasonAttributes = { + context: 'BaseSelectionListWithSections', + shouldShowLoadingPlaceholder, + }; + return ; } if (shouldShowListEmptyContent) { return listEmptyContent; diff --git a/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx b/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx index 57b3d60dd181c..9b90b4a4d12c4 100644 --- a/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx +++ b/src/components/SelectionListWithSections/BaseSelectionListWithSections.tsx @@ -25,6 +25,7 @@ import {focusedItemRef} from '@hooks/useSyncFocus/useSyncFocusImplementation'; import useThemeStyles from '@hooks/useThemeStyles'; import getSectionsWithIndexOffset from '@libs/getSectionsWithIndexOffset'; import Log from '@libs/Log'; +import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan'; import variables from '@styles/variables'; import CONST from '@src/CONST'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; @@ -717,11 +718,17 @@ function BaseSelectionListWithSections({ const renderListEmptyContent = () => { if (shouldShowLoadingPlaceholder) { + const reasonAttributes: SkeletonSpanReasonAttributes = { + context: 'BaseSelectionListWithSections', + shouldShowLoadingPlaceholder, + shouldUseUserSkeletonView, + }; return ( ); } diff --git a/src/components/SelectionListWithSections/types.ts b/src/components/SelectionListWithSections/types.ts index 122485116a1dc..d82358af34486 100644 --- a/src/components/SelectionListWithSections/types.ts +++ b/src/components/SelectionListWithSections/types.ts @@ -21,6 +21,7 @@ import type {ValueOf} from 'type-fest'; import type {SearchRouterItem} from '@components/Search/SearchAutocompleteList'; import type {SearchColumnType, SearchGroupBy, SearchQueryJSON} from '@components/Search/types'; import type {ForwardedFSClassProps} from '@libs/Fullstory/types'; +import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan'; import type {BrickRoad} from '@libs/WorkspacesSettingsUtils'; import type UnreportedExpenseListItem from '@pages/UnreportedExpenseListItem'; // eslint-disable-next-line no-restricted-imports @@ -811,6 +812,7 @@ type LoadingPlaceholderComponentProps = { shouldStyleAsTable?: boolean; fixedNumItems?: number; speed?: number; + reasonAttributes?: SkeletonSpanReasonAttributes; }; type SectionWithIndexOffset = Section & { diff --git a/src/pages/inbox/sidebar/SidebarLinks.tsx b/src/pages/inbox/sidebar/SidebarLinks.tsx index 0781a7b5979d3..4c1bdc22ff6be 100644 --- a/src/pages/inbox/sidebar/SidebarLinks.tsx +++ b/src/pages/inbox/sidebar/SidebarLinks.tsx @@ -13,6 +13,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {setSidebarLoaded} from '@libs/actions/App'; import Navigation from '@libs/Navigation/Navigation'; import {cancelSpan} from '@libs/telemetry/activeSpans'; +import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan'; import * as ReportActionContextMenu from '@pages/inbox/report/ContextMenu/ReportActionContextMenu'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -76,6 +77,12 @@ function SidebarLinks({insets, optionListItems, priorityMode = CONST.PRIORITY_MO const viewMode = priorityMode === CONST.PRIORITY_MODE.GSD ? CONST.OPTION_MODE.COMPACT : CONST.OPTION_MODE.DEFAULT; + const sidebarSkeletonReasonAttributes: SkeletonSpanReasonAttributes = { + context: 'SidebarLinks', + isLoadingReportData, + optionListItemsCount: optionListItems?.length, + }; + // eslint-disable-next-line react-hooks/exhaustive-deps const contentContainerStyles = useMemo(() => StyleSheet.flatten([styles.pt2, {paddingBottom: StyleUtils.getSafeAreaMargins(insets).marginBottom}]), [insets]); @@ -91,9 +98,12 @@ function SidebarLinks({insets, optionListItems, priorityMode = CONST.PRIORITY_MO optionMode={viewMode} onFirstItemRendered={setSidebarLoaded} /> - {!!isLoadingReportData && optionListItems?.length === 0 && ( + {isLoadingReportData && optionListItems?.length === 0 && ( - + )}