-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[No QA] [BYOC] [Bulk Card Assignments] Release 1+2: Loading states #78167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tgolen
merged 21 commits into
Expensify:byoc-bulk-card-assign-r1
from
margelo:byoc-bulk-card-assign-loading-states
Dec 20, 2025
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f255ffa
refactor: workspace company cards page + table
chrispader b0dbd6a
Update useCompanyCards.ts
chrispader d5f10c5
Update useCardsList.tsx
chrispader 99fcc15
Merge branch 'byoc-bulk-card-assign-r1' into byoc-bulk-card-assign-lo…
chrispader acca634
fix: more merge conflicts
chrispader c08e847
fix: merge conflicts
chrispader 9d492c5
refactor: table header buttons props
chrispader a5bd5bd
fix: assign card row not rendering on mobile
chrispader 025dc16
fix: too many Auth requests
chrispader 64ac20d
feat: add skeleton loaders
chrispader 8c73e32
fix: card types
chrispader 058e66d
revert: card.bank tyep
chrispader 5bb9a16
fix: row loading skeletons
chrispader 5227d52
fix: unused imports
chrispader f023330
fix: UI on mobile
chrispader face997
fix: adapt mobile styling
chrispader fe85a9b
fix: remove unused import
chrispader 0b59954
fix: empty state components
chrispader 042414c
Merge branch 'byoc-bulk-card-assign-r1' into byoc-bulk-card-assign-lo…
chrispader 8f38e64
fix: address revuew comments
chrispader 4fe61b0
fix: line formatting
chrispader File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import type {OnyxCollection, ResultMetadata} from 'react-native-onyx'; | ||
| import type {ValueOf} from 'type-fest'; | ||
| import {getCompanyCardFeed, getCompanyFeeds, getPlaidInstitutionId} from '@libs/CardUtils'; | ||
| import type CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type {CardFeeds, CardList} from '@src/types/onyx'; | ||
| import type {AssignableCardsList, WorkspaceCardsList} from '@src/types/onyx/Card'; | ||
| import type {CompanyCardFeed, CompanyCardFeedWithDomainID, CompanyFeeds} from '@src/types/onyx/CardFeeds'; | ||
| import useCardFeeds from './useCardFeeds'; | ||
| import type {CombinedCardFeed, CombinedCardFeeds} from './useCardFeeds'; | ||
| import useCardsList from './useCardsList'; | ||
| import useOnyx from './useOnyx'; | ||
|
|
||
| type CardFeedType = ValueOf<typeof CONST.COMPANY_CARDS.FEED_TYPE>; | ||
|
|
||
| type UsCompanyCardsResult = Partial<{ | ||
| cardFeedType: CardFeedType; | ||
| bankName: CompanyCardFeed; | ||
| feedName: CompanyCardFeedWithDomainID; | ||
| cardList: AssignableCardsList; | ||
| assignedCards: CardList; | ||
| cardNames: string[]; | ||
| allCardFeeds: CombinedCardFeeds; | ||
| companyCardFeeds: CompanyFeeds; | ||
| selectedFeed: CombinedCardFeed; | ||
| }> & { | ||
| onyxMetadata: { | ||
| cardListMetadata: ResultMetadata<WorkspaceCardsList>; | ||
| allCardFeedsMetadata: ResultMetadata<OnyxCollection<CardFeeds>>; | ||
| }; | ||
| }; | ||
|
|
||
| function useCompanyCards(policyID?: string): UsCompanyCardsResult { | ||
| const [lastSelectedFeed] = useOnyx(`${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${policyID}`, {canBeMissing: true}); | ||
| const [allCardFeeds, allCardFeedsMetadata] = useCardFeeds(policyID); | ||
|
|
||
| const feedName = lastSelectedFeed; | ||
| const bankName = feedName ? getCompanyCardFeed(feedName) : undefined; | ||
|
|
||
| const [cardsList, cardListMetadata] = useCardsList(feedName); | ||
|
|
||
| const companyCardFeeds = getCompanyFeeds(allCardFeeds); | ||
| const selectedFeed = feedName && companyCardFeeds[feedName]; | ||
| const isPlaidCardFeed = !!getPlaidInstitutionId(feedName); | ||
|
|
||
| let cardFeedType: CardFeedType = 'customFeed'; | ||
| if (isPlaidCardFeed) { | ||
| cardFeedType = 'directFeed'; | ||
| } | ||
|
Comment on lines
+46
to
+49
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not only plaid connected feeds are direct, we also have native direct connections. This caused this regression https://expensify.slack.com/archives/C05LX9D6E07/p1767116486536099 |
||
|
|
||
| const {cardList, ...assignedCards} = cardsList ?? {}; | ||
| const cardNames = cardFeedType === 'directFeed' ? (selectedFeed?.accountList ?? []) : Object.keys(cardList ?? {}); | ||
|
|
||
| const onyxMetadata = { | ||
| cardListMetadata, | ||
| allCardFeedsMetadata, | ||
| }; | ||
|
|
||
| if (!policyID) { | ||
| return {onyxMetadata}; | ||
| } | ||
|
|
||
| return {allCardFeeds, feedName, companyCardFeeds, cardList, assignedCards, cardNames, selectedFeed, bankName, cardFeedType, onyxMetadata}; | ||
| } | ||
|
|
||
| export default useCompanyCards; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.