Skip to content
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

[Internal QA] Implement additional loading indication during direct feed connection #54999

Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Lint fixes
VickyStash committed Jan 9, 2025

Verified

This commit was signed with the committer’s verified signature.
commit 768d763831b6c694473f73e407023ec8f031df3c
8 changes: 7 additions & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import type {SearchQueryString} from './components/Search/types';
import type CONST from './CONST';
import type {IOUAction, IOUType} from './CONST';
import type {IOURequestType} from './libs/actions/IOU';
import Log from './libs/Log';
import type {ExitReason} from './types/form/ExitSurveyReasonForm';
import type {ConnectionName, SageIntacctMappingName} from './types/onyx/Policy';
import type AssertTypesNotEqual from './types/utils/AssertTypesNotEqual';
@@ -1221,7 +1222,12 @@ const ROUTES = {
},
WORKSPACE_COMPANY_CARDS: {
route: 'settings/workspaces/:policyID/company-cards',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/company-cards` as const,
getRoute: (policyID: string | undefined) => {
if (!policyID) {
Log.warn('Invalid policyID is used to build the WORKSPACE_COMPANY_CARDS route');
}
return `settings/workspaces/${policyID}/company-cards` as const;
},
},
WORKSPACE_COMPANY_CARDS_ADD_NEW: {
route: 'settings/workspaces/:policyID/company-cards/add-card-feed',
6 changes: 5 additions & 1 deletion src/libs/actions/Card.ts
Original file line number Diff line number Diff line change
@@ -875,7 +875,11 @@ function toggleContinuousReconciliation(workspaceAccountID: number, shouldUseCon
});
}

function updateSelectedFeed(feed: CompanyCardFeed, policyID: string) {
function updateSelectedFeed(feed: CompanyCardFeed, policyID: string | undefined) {
if (!policyID) {
return;
}

Onyx.update([
{
onyxMethod: Onyx.METHOD.MERGE,
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ function BankConnection({policyID}: BankConnectionStepProps) {
const [addNewCard] = useOnyx(ONYXKEYS.ADD_NEW_COMPANY_CARD);
const bankName: ValueOf<typeof CONST.COMPANY_CARDS.BANKS> | undefined = addNewCard?.data?.selectedBank;
const url = getCompanyCardBankConnection(policyID, bankName);
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID ?? '-1');
const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyID);
const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`);
const [isConnectionCompleted, setConnectionCompleted] = useState(false);
const prevFeedsData = usePrevious(cardFeeds?.settings?.oAuthAccountDetails);
@@ -63,9 +63,9 @@ function BankConnection({policyID}: BankConnectionStepProps) {
}
if (isNewFeedConnected) {
if (newFeed) {
Card.updateSelectedFeed(newFeed, policyID ?? '-1');
Card.updateSelectedFeed(newFeed, policyID);
}
Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARDS.getRoute(policyID ?? '-1'));
Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARDS.getRoute(policyID));
}
}, [isNewFeedConnected, newFeed, policyID, url]);