Skip to content

Commit ec708e7

Browse files
authored
Merge pull request Expensify#84395 from callstack-internal/fix/add-reason-attributes-table-row-skeleton
[No QA] Add reasonAttributes to TableRowSkeleton usage sites
2 parents da28c7f + 720ece2 commit ec708e7

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

src/pages/workspace/companyCards/WorkspaceCompanyCardsTable/WorkspaceCompanyCardsTableItem.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import useTheme from '@hooks/useTheme';
1616
import useThemeStyles from '@hooks/useThemeStyles';
1717
import {formatMaskedCardName, getCardFeedWithDomainID, lastFourNumbersFromCardName, splitMaskedCardNumber} from '@libs/CardUtils';
1818
import Navigation from '@libs/Navigation/Navigation';
19+
import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan';
1920
import {getDefaultAvatarURL} from '@libs/UserAvatarUtils';
2021
import CONST from '@src/CONST';
2122
import ROUTES from '@src/ROUTES';
@@ -94,6 +95,11 @@ function WorkspaceCompanyCardTableItem({
9495
const assignCard = () => onAssignCard(cardName, encryptedCardNumber);
9596
const isDeleting = !isOffline && pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
9697

98+
const reasonAttributes: SkeletonSpanReasonAttributes = {
99+
context: 'WorkspaceCompanyCardsTableItem',
100+
isDeleting,
101+
};
102+
97103
return (
98104
<OfflineWithFeedback
99105
errorRowStyles={[styles.ph5, styles.mb4]}
@@ -107,6 +113,7 @@ function WorkspaceCompanyCardTableItem({
107113
<TableRowSkeleton
108114
fixedNumItems={1}
109115
useCompanyCardsLayout
116+
reasonAttributes={reasonAttributes}
110117
/>
111118
</View>
112119
) : (

src/pages/workspace/companyCards/WorkspaceCompanyCardsTable/index.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
1818
import useThemeStyles from '@hooks/useThemeStyles';
1919
import {resetFailedWorkspaceCompanyCardUnassignment} from '@libs/actions/CompanyCards';
2020
import {getDefaultCardName, getPlaidInstitutionId} from '@libs/CardUtils';
21+
import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan';
2122
import tokenizedSearch from '@libs/tokenizedSearch';
2223
import WorkspaceCompanyCardPageEmptyState from '@pages/workspace/companyCards/WorkspaceCompanyCardPageEmptyState';
2324
import WorkspaceCompanyCardsFeedAddedEmptyPage from '@pages/workspace/companyCards/WorkspaceCompanyCardsFeedAddedEmptyPage';
@@ -330,6 +331,12 @@ function WorkspaceCompanyCardsTable({
330331
</View>
331332
) : undefined;
332333

334+
const reasonAttributes: SkeletonSpanReasonAttributes = {
335+
context: 'WorkspaceCompanyCardsTable',
336+
isLoading,
337+
isLoadingCards,
338+
};
339+
333340
return (
334341
<Table
335342
ref={tableRef}
@@ -342,14 +349,28 @@ function WorkspaceCompanyCardsTable({
342349
isItemInFilter={isItemInFilter}
343350
filters={filterConfig}
344351
initialSortColumn="member"
345-
ListEmptyComponent={isLoadingCards ? <TableRowSkeleton fixedNumItems={5} /> : <WorkspaceCompanyCardsFeedAddedEmptyPage shouldShowGBDisclaimer={shouldShowGBDisclaimer} />}
352+
ListEmptyComponent={
353+
isLoadingCards ? (
354+
<TableRowSkeleton
355+
fixedNumItems={5}
356+
reasonAttributes={reasonAttributes}
357+
/>
358+
) : (
359+
<WorkspaceCompanyCardsFeedAddedEmptyPage shouldShowGBDisclaimer={shouldShowGBDisclaimer} />
360+
)
361+
}
346362
ListHeaderComponent={shouldUseNarrowTableLayout ? headerButtonsComponent : undefined}
347363
>
348364
{shouldRenderHeaderAsChild && headerButtonsComponent}
349365

350366
{(isLoading || isFeedPending || isNoFeed) && !feedErrorKey && (
351367
<ScrollView>
352-
{isLoading && <TableRowSkeleton fixedNumItems={5} />}
368+
{isLoading && (
369+
<TableRowSkeleton
370+
fixedNumItems={5}
371+
reasonAttributes={reasonAttributes}
372+
/>
373+
)}
353374

354375
{!isLoading && isFeedPending && (
355376
<View style={styles.flex1}>

0 commit comments

Comments
 (0)